You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
566 B
20 lines
566 B
#!/usr/bin/env python3
|
|
import urllib.request
|
|
import json
|
|
|
|
req = urllib.request.Request(
|
|
'http://localhost:8080/v1/admin/adapters',
|
|
headers={'X-Admin-Token': 'demo-api-key-2024'}
|
|
)
|
|
|
|
try:
|
|
response = urllib.request.urlopen(req, timeout=10)
|
|
data = json.loads(response.read().decode())
|
|
print('Success!')
|
|
print("Code:", data['code'])
|
|
print("Adapters count:", len(data['data']['adapters']))
|
|
for adapter in data['data']['adapters']:
|
|
print(" -", adapter['name'] + ":", adapter['status'])
|
|
except Exception as e:
|
|
print('Error:', e)
|