Files
aza/AzA march 2026 - Kopie (27)/hetzner_diag_woo_403_extra.py

35 lines
994 B
Python
Raw Normal View History

2026-05-20 00:09:28 +02:00
#!/usr/bin/env python3
"""Extra probes: no Woo auth, UA variants — stdout only safe prefixes."""
import requests
BASE = "https://aza-medwork.ch"
def main() -> None:
cases = [
("wpjson_no_auth_requests_ua", {}),
(
"wpjson_no_auth_browser_ua",
{
"headers": {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) Chrome/120.0.0.0",
"Accept": "application/json",
}
},
),
]
for label, kw in cases:
r = requests.get(BASE + "/wp-json", timeout=15, **kw)
ct = (r.headers.get("content-type") or "")[:50]
pref = (r.text or "")[:80].replace("\n", " ")
print(label, "http", r.status_code, "ct", ct)
print(label, "body_prefix", pref)
# HEAD request
r = requests.head(BASE + "/wp-json", timeout=15, allow_redirects=True)
print("wpjson_head_http", r.status_code)
if __name__ == "__main__":
main()