handle request errors

This commit is contained in:
Mylloon 2022-08-08 09:09:21 +02:00
parent 3b5c78f539
commit dcda3d107e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

13
main.py
View file

@ -172,6 +172,19 @@ class Listener(StreamingClient):
if keys["VERBOSE"]: if keys["VERBOSE"]:
print("Annulation car le dernier mot n'est pas intéressant.") print("Annulation car le dernier mot n'est pas intéressant.")
def on_request_error(self, status_code):
print(f"{errorMessage[:-2]} ({status_code}) !", end=" ")
match status_code:
case 420:
if keys["VERBOSE"]:
print("Déconnecter du flux.")
case 429:
if keys["VERBOSE"]:
print("En attente de reconnexion...")
case _:
print("\n")
return False
def repeater(word: str) -> str: def repeater(word: str) -> str:
"""Formating a word who need to be repeated""" """Formating a word who need to be repeated"""