mirror of
https://github.com/rangermix/TwitchDropsMiner.git
synced 2026-05-31 01:19:36 +00:00
Add 5XX http code handling
This commit is contained in:
12
twitch.py
12
twitch.py
@@ -856,9 +856,15 @@ class Twitch:
|
||||
for attempt in range(attempts):
|
||||
logger.debug(f"Request: ({method=}, {url=}, {attempts=}, {kwargs=})")
|
||||
try:
|
||||
async with session.request(method, url, **kwargs) as response:
|
||||
logger.debug(f"Response: {response.status}: {response}")
|
||||
yield response
|
||||
while True:
|
||||
async with session.request(method, url, **kwargs) as response:
|
||||
logger.debug(f"Response: {response.status}: {response}")
|
||||
if response.status >= 500:
|
||||
self.print("Twitter is down, retrying in 120 seconds...")
|
||||
await asyncio.sleep(120)
|
||||
continue
|
||||
yield response
|
||||
break
|
||||
return
|
||||
except aiohttp.ClientConnectionError as exc:
|
||||
cause = exc
|
||||
|
||||
Reference in New Issue
Block a user