33 lines
1.0 KiB
Python
33 lines
1.0 KiB
Python
|
|
import urllib.request, json
|
||
|
|
def get(path):
|
||
|
|
try:
|
||
|
|
r = urllib.request.urlopen(f'http://127.0.0.1:8765{path}', timeout=5)
|
||
|
|
return json.loads(r.read())
|
||
|
|
except Exception as e:
|
||
|
|
return {'error': str(e)}
|
||
|
|
|
||
|
|
print('=== Health ===')
|
||
|
|
print(get('/api/health'))
|
||
|
|
|
||
|
|
print('\n=== Favorites ===')
|
||
|
|
r = get('/api/dashboard/favorites')
|
||
|
|
print(f'{len(r)} favorieten (eerste: {r[0]["title"] if r else "geen"})')
|
||
|
|
|
||
|
|
print('\n=== Overview ===')
|
||
|
|
r = get('/api/dashboard/overview')
|
||
|
|
print(f'Stats: {r["favorites_count"]} favs, {r["password_count"]} pws, {r["photo_count"]} photos')
|
||
|
|
|
||
|
|
print('\n=== Calendar ===')
|
||
|
|
r = get('/api/dashboard/calendar?days=7')
|
||
|
|
print(f'{len(r)} events komende 7 dagen')
|
||
|
|
|
||
|
|
print('\n=== Dashboard HTML ===')
|
||
|
|
r2 = urllib.request.urlopen('http://127.0.0.1:8765/dashboard', timeout=5)
|
||
|
|
print(f'Dashboard pagina: {r2.status} ({len(r2.read())} bytes)')
|
||
|
|
|
||
|
|
print('\n=== Homepage ===')
|
||
|
|
r3 = urllib.request.urlopen('http://127.0.0.1:8765/', timeout=5)
|
||
|
|
print(f'Voice control pagina: {r3.status} ({len(r3.read())} bytes)')
|
||
|
|
|
||
|
|
print('\n[OK] Alle endpoints werken!')
|