mirror of
https://github.com/onionshare/onionshare.git
synced 2025-03-13 01:16:31 -04:00
Wait between weblate API requests to avoid hammering the server
This commit is contained in:
parent
bbd55d3f24
commit
9d4a9ca2d0
@ -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