From 823c017fa4d07ef9d2ea5322946123630e975c76 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 29 Jul 2023 11:08:07 +0200 Subject: [PATCH] initial request can also fail, retry --- pandora_client/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_client/__init__.py b/pandora_client/__init__.py index 21b5dfc..89d3de8 100755 --- a/pandora_client/__init__.py +++ b/pandora_client/__init__.py @@ -1118,8 +1118,17 @@ class API(ox.API): if resume: data = resume else: - data = self._json_request(url, data) - + data = None + while not data: + try: + data = self._json_request(url, data) + except KeyboardInterrupt: + print("\ninterrupted by user.") + sys.exit(1) + except: + print("failed to start upload, will try again in 5 seconds\r", end='') + sys.stdout.flush() + time.sleep(5) print(filename) hide_cursor()