Files
SnarfCode/scripts/check_homepage_api.py

27 lines
805 B
Python

import requests
import json
import urllib3
urllib3.disable_warnings()
s = requests.Session()
r = s.get('https://homepage.snarfnet.net/api/services', verify=False)
print("Status /api/services:", r.status_code)
try:
data = r.json()
print("Services JSON keys/length:", len(data))
for group in data:
for title, items in group.items():
print(f"Group: {title}")
for item in items:
print(f" - {item.get('name')}: widget={item.get('widget')}")
except Exception as e:
print("Error:", e, r.text[:200])
r2 = s.get('https://homepage.snarfnet.net/api/widgets', verify=False)
print("Status /api/widgets:", r2.status_code)
try:
print("Widgets:", json.dumps(r2.json(), indent=2))
except Exception as e:
print("Error widgets:", e, r2.text[:200])