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.
21 lines
639 B
21 lines
639 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(f"Code: {data['code']}")
|
|
print(f"Message: {data['message']}")
|
|
print(f"Adapters count: {len(data['data']['adapters'])}")
|
|
for adapter in data['data']['adapters']:
|
|
print(f" - {adapter['name']}: {adapter['status']} ({adapter['type']})")
|
|
except Exception as e:
|
|
print(f'✗ Error: {e}')
|