fix(scripts): vibegram join sends a user-agent, cloudflare blocks the default
This commit is contained in:
1 parent
d8ab6bb72c
commit
6e28ff1e5b
1 file changed
+4
-1
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user