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
@@ -64,6 +64,8 @@ def http_json(method, url, headers=None, body=None, form=None, timeout=30):
"""Returns (status, parsed-json-or-{'raw': 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-sync/{VERSION}")
if form is not None:
data = urllib.parse.urlencode(form).encode()
hdrs.setdefault("Content-Type", "application/x-www-form-urlencoded")