mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 03:37:28 -03:00
Wait between weblate API requests to avoid hammering the server
This commit is contained in:
parent
2a67f9a78f
commit
11a4ed05a6
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue