feat: add helper scripts for infrastructure management and troubleshooting
This commit is contained in:
20
scripts/test_nas_endpoints.py
Normal file
20
scripts/test_nas_endpoints.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
|
||||
for host in ["https://sn-nas.snarfnet.net", "https://snarfnas.snarfnet.net"]:
|
||||
try:
|
||||
req = urllib.request.Request(host, headers={"User-Agent": "Mozilla/5.0"})
|
||||
with urllib.request.urlopen(req, context=ctx, timeout=8) as resp:
|
||||
print(f"{host} -> Status: {resp.status}, Content-Length: {resp.headers.get('Content-Length')}")
|
||||
body = resp.read().decode('utf-8', errors='replace')
|
||||
print("Title/Body preview:", body[:300].replace('\n', ' '))
|
||||
except Exception as e:
|
||||
print(f"{host} -> Error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user