From 178cb85d040ec73b7e0564169fe4b7cb2d05085a Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Sat, 6 May 2023 20:59:11 -0700 Subject: Implemented failsafe for APIs --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 8f11942..f39df87 100644 --- a/main.py +++ b/main.py @@ -107,10 +107,13 @@ def main(mode=0): if mode == 0: holodex_organizations = HOLODEX_ORG.split(",") print("Running Holodex API Data Collection\n"+"Found "+str(len(holodex_organizations))+" organizations") - for org in holodex_organizations: - hldex = HolodexAPI(fs.get_api_key("holodex_api_key"), member_count = ORG_MEMBER_COUNT, organization = org) - data += hldex.get_data_all_channels() - excluded_channels += hldex.get_exclude_channels() + try: + for org in holodex_organizations: + hldex = HolodexAPI(fs.get_api_key("holodex_api_key"), member_count = ORG_MEMBER_COUNT, organization = org) + data += hldex.get_data_all_channels() + excluded_channels += hldex.get_exclude_channels() + except: + main(mode=1) elif mode == 1: print("Running YouTube API Data Collection") -- cgit v1.2.3