25 lines
1019 B
Python
25 lines
1019 B
Python
import urllib.request
|
|
import ssl
|
|
import json
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
# Test authorize URL for pihole1
|
|
url1 = "https://authentik.snarfnet.net/application/o/authorize/?client_id=H5MRodgRNAMuKv2fXsj3roxfO1f9ImOSRAN2Pi47&redirect_uri=https%3A%2F%2Fpihole1.snarfnet.net%2Foutpost.goauthentik.io%2Fcallback%3FX-authentik-auth-callback%3Dtrue&response_type=code&scope=ak_proxy+openid+entitlements+profile+email"
|
|
|
|
req = urllib.request.Request(url1, headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'})
|
|
try:
|
|
with urllib.request.urlopen(req, context=ctx, timeout=8) as resp:
|
|
print("Status code:", resp.status)
|
|
print("Final URL:", resp.url)
|
|
content = resp.read().decode('utf-8')
|
|
print("Content sample (first 500 chars):")
|
|
print(content[:500])
|
|
except urllib.error.HTTPError as e:
|
|
print(f"HTTP Error {e.code}: {e.read().decode('utf-8')[:500]}")
|
|
except Exception as e:
|
|
print("Exception:", e)
|
|
|