feat: add helper scripts for infrastructure management and troubleshooting
This commit is contained in:
36
scripts/test_npm_endpoints.py
Normal file
36
scripts/test_npm_endpoints.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import urllib.request
|
||||
import ssl
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
class NoRedirectHandler(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
return None
|
||||
|
||||
opener = urllib.request.build_opener(NoRedirectHandler)
|
||||
|
||||
tests = [
|
||||
"https://longhorn.aerodrome.snarfnet.net",
|
||||
"https://semaphore.snarfnet.net",
|
||||
"https://uptime.snarfnet.net",
|
||||
"https://pihole1.snarfnet.net",
|
||||
"https://pihole2.snarfnet.net"
|
||||
]
|
||||
|
||||
print("=== Testing External/NPM Endpoints ===")
|
||||
for url in tests:
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
try:
|
||||
resp = opener.open(req, timeout=8)
|
||||
print(f"✓ {url} -> {resp.status} {resp.reason}")
|
||||
except urllib.error.HTTPError as e:
|
||||
loc = e.headers.get('Location', '')
|
||||
print(f"✓ {url} -> {e.code} {e.reason} (Location: {loc[:80]}...)")
|
||||
except Exception as e:
|
||||
print(f"✗ {url} -> Error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user