From dcda3d107e61f38cb4ec4e9dcca520dd2f231856 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 8 Aug 2022 09:09:21 +0200 Subject: [PATCH] handle request errors --- main.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.py b/main.py index b04faed..9d94d17 100644 --- a/main.py +++ b/main.py @@ -172,6 +172,19 @@ class Listener(StreamingClient): if keys["VERBOSE"]: 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: """Formating a word who need to be repeated"""