fix: send explicit User-Agent (Cloudflare 403s default Python-urllib UA at id.shre.ai)

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
Nirav Patel
2026-08-19 00:11:38 -04:00
co-authored by Claude Fable 5
parent 2077591755
commit 16d6a30c04
4 changed files with 4 additions and 0 deletions
+2
View File
@@ -69,6 +69,8 @@ def http_json(method, url, headers=None, body=None, timeout=20):
"""Minimal JSON-over-HTTP helper. Returns (status, parsed_or_text)."""
data = None
hdrs = dict(headers or {})
# Cloudflare in front of id.shre.ai 403s the default Python-urllib UA.
hdrs.setdefault("User-Agent", f"granthi-link/{VERSION}")
if body is not None:
data = json.dumps(body).encode()
hdrs.setdefault("Content-Type", "application/json")