fix(scripts): vibegram join sends a user-agent, cloudflare blocks the default

This commit is contained in:
hh committed 2026-09-22 14:25:35 +00:00
1 parent d8ab6bb72c
commit 6e28ff1e5b
1 file changed
+4 -1
+4 -1
View File
@@ -26,6 +26,7 @@ import urllib.request
from pathlib import Path
ENV = Path(__file__).resolve().parent.parent / ".env"
USER_AGENT = "beaver-agent/0.1 (+vibegram)"
def hub_from_env() -> str | None:
@@ -56,7 +57,9 @@ def main() -> int:
request = urllib.request.Request( # noqa: S310 - адрес хаба задаёт оператор
f"{args.hub.rstrip('/')}/api/rooms/join",
data=json.dumps(body).encode(),
headers={"content-type": "application/json"},
# Перед хабом Cloudflare: безымянный `Python-urllib` он отбивает 1010.
# Тот же user-agent, что у клиента в `beaver_agent/hands/vibegram.py`.
headers={"content-type": "application/json", "user-agent": USER_AGENT},
method="POST",
)
try: