aboutsummaryrefslogtreecommitdiffstats
path: root/python/api_quotes/__main__.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/api_quotes/__main__.py')
-rw-r--r--python/api_quotes/__main__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/python/api_quotes/__main__.py b/python/api_quotes/__main__.py
index eae330d3..d75f7ca9 100644
--- a/python/api_quotes/__main__.py
+++ b/python/api_quotes/__main__.py
@@ -15,6 +15,7 @@ logger = logging.getLogger(__name__)
def process_asset_class(asset_class, start_from, end):
already_uploaded = MarkitQuoteKind[asset_class].already_uploaded()
+ retry = 0
while True:
try:
if data := MarkitAPI.get_data(asset_class, start_from):
@@ -48,9 +49,15 @@ def process_asset_class(asset_class, start_from, end):
else:
return
except JSONDecodeError:
- print(f"Issue with {asset_class}: {start_from}")
+ logger.error(f"Issue with {asset_class}: {start_from}")
+ return
except AttributeError:
- MarkitAPI.update_api_key()
+ if retry < 3:
+ MarkitAPI.update_api_key()
+ else:
+ logger.error("API failed after 3 tries")
+ return
+ retry += 1
if __name__ == "__main__":