aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2021-11-26 10:51:30 -0800
committerMicah Lee <micah@micahflee.com>2021-11-26 10:51:30 -0800
commit11a4ed05a69e4acaa51385348bdaa0bba7412ede (patch)
treeab42ec8dfbaf92071d87630d4ae4bb219276575a
parent2a67f9a78f6014c1afadb81909c8c9205a3634fe (diff)
downloadonionshare-11a4ed05a69e4acaa51385348bdaa0bba7412ede.tar.gz
onionshare-11a4ed05a69e4acaa51385348bdaa0bba7412ede.zip
Wait between weblate API requests to avoid hammering the server
-rwxr-xr-xdocs/check-weblate.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/docs/check-weblate.py b/docs/check-weblate.py
index a5dc4dc8..76cc6942 100755
--- a/docs/check-weblate.py
+++ b/docs/check-weblate.py
@@ -13,6 +13,10 @@ docs_translations = {}
async def api(path):
url = f"https://hosted.weblate.org{path}"
+ # Wait a bit before each API call, to avoid hammering the server and
+ # getting temporarily blocked
+ await asyncio.sleep(1)
+
async with httpx.AsyncClient() as client:
r = await client.get(
url, headers={"Authorization": f"Token {api_token}"}, timeout=60