fix(agent): set explicit User-Agent on register POST
Python's `urllib.request.Request` defaults to `Python-urllib/<ver>`, which Cloudflare's Browser Integrity Check on `riahub.ai` blacklists (HTTP 403 with edge error code 1010). The register POST never reached the hub. Any non-default UA passes the check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
84f3a63e8b
commit
5f68fd936d
|
|
@ -43,12 +43,16 @@ def _cmd_register(args: argparse.Namespace) -> int:
|
|||
hub_url = args.hub.rstrip("/")
|
||||
url = f"{hub_url}/screens/agents/register"
|
||||
body = json.dumps({"name": args.name or ""}).encode()
|
||||
# Explicit User-Agent: Python's default `Python-urllib/<ver>` is blocked
|
||||
# by Cloudflare's Browser Integrity Check on `riahub.ai` (HTTP 403 code
|
||||
# 1010), so register() never reached the hub. Any non-default UA passes.
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=body,
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-API-Key": args.api_key,
|
||||
"User-Agent": "ria-agent/0.1 (+https://github.com/RIA-Toolkit/ria-toolkit-oss)",
|
||||
},
|
||||
)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user