more gracefully handle rate limiting (in theory anyway)
This commit is contained in:
parent
adf781c48f
commit
802b9d3906
|
@ -220,9 +220,13 @@ async def listen(c, me):
|
||||||
reply_text += '\n\n' + '\n'.join(cards)
|
reply_text += '\n\n' + '\n'.join(cards)
|
||||||
|
|
||||||
if media:
|
if media:
|
||||||
|
try:
|
||||||
media_ids = []
|
media_ids = []
|
||||||
for image, desc in media:
|
for image, desc in media:
|
||||||
media_ids.append((await c.upload_attachment(fileobj=image, params={}, description=desc))['id'])
|
media_ids.append((await c.upload_attachment(fileobj=image, params={}, description=desc))['id'])
|
||||||
|
except atoot.api.RatelimitError:
|
||||||
|
media_ids = None
|
||||||
|
reply_text += '\n\nMedia attachments are temporarily disabled due to API restrictions, they will return shortly.'
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Oops!
|
# Oops!
|
||||||
log(traceback.print_exc(), Severity.ERROR)
|
log(traceback.print_exc(), Severity.ERROR)
|
||||||
|
|
Loading…
Reference in New Issue