Files
SnarfCode/scripts/test_authentik_api.py

23 lines
740 B
Python

import urllib.request
import ssl
import json
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
req = urllib.request.Request(
"https://authentik.snarfnet.net/api/v3/core/applications/",
headers={"Authorization": "Bearer SnarfNetPermanentAutomationToken2026"}
)
try:
with urllib.request.urlopen(req, context=ctx, timeout=5) as resp:
data = json.loads(resp.read().decode('utf-8'))
print("Authentik API status:", resp.status)
print("Total applications:", data.get('pagination', {}).get('count'))
for app in data.get('results', [])[:5]:
print(f" App: {app.get('name')} ({app.get('slug')})")
except Exception as e:
print("API Error:", e)