Files
SnarfCode/scripts/test_sem_redirect.py

21 lines
659 B
Python

import urllib.request
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
def test_url(url):
print(f"Testing {url}:")
try:
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
with urllib.request.urlopen(req, context=ctx) as resp:
print("Status:", resp.status)
print(resp.read().decode())
except urllib.error.HTTPError as e:
print(f"HTTP {e.code}:", e.read().decode())
test_url("https://semaphore.snarfnet.net/api/auth/oidc/authentik/redirect")
test_url("https://semaphore.snarfnet.net/api/auth/oidc/authentik/redirect/")