27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
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
|
|
|
|
tests = [
|
|
("sn-nas", "https://sn-nas.snarfnet.net/"),
|
|
("sn-nas UIString", "https://sn-nas.snarfnet.net/webapi/entry.cgi?api=SYNO.Core.Desktop.UIString&version=1&method=getjs&lang=enu"),
|
|
("snarfnas", "https://snarfnas.snarfnet.net/"),
|
|
("snarfnas UIString", "https://snarfnas.snarfnet.net/webapi/entry.cgi?api=SYNO.Core.Desktop.UIString&version=1&method=getjs&lang=enu"),
|
|
]
|
|
|
|
for label, url in tests:
|
|
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
|
|
try:
|
|
with urllib.request.urlopen(req, context=ctx, timeout=10) as resp:
|
|
content = resp.read()
|
|
print(f"✓ {label}: Status {resp.status}, Size {len(content):,} bytes, Preview: {content[:80].decode('utf-8', errors='replace').strip()}")
|
|
except Exception as e:
|
|
print(f"✗ {label}: Error {e}")
|
|
|