mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-26 14:36:03 -05:00
Wait between weblate API requests to avoid hammering the server
This commit is contained in:
parent
2a67f9a78f
commit
11a4ed05a6
@ -13,6 +13,10 @@ docs_translations = {}
|
|||||||
async def api(path):
|
async def api(path):
|
||||||
url = f"https://hosted.weblate.org{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:
|
async with httpx.AsyncClient() as client:
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
url, headers={"Authorization": f"Token {api_token}"}, timeout=60
|
url, headers={"Authorization": f"Token {api_token}"}, timeout=60
|
||||||
|
Loading…
x
Reference in New Issue
Block a user