return None on failed remote key lookup

This commit is contained in:
Piero Toffanin 2022-06-21 16:37:06 -04:00
parent ed68f1bcf9
commit 47fc85fdec

View file

@ -76,13 +76,12 @@ class RemoteDatabase:
res = r.json() res = r.json()
except Exception as e: except Exception as e:
print("Cannot authenticate API key: " + str(e)) print("Cannot authenticate API key: " + str(e))
return False return None
if res.get('error', None) is None: if res.get('error', None) is None:
req_limit = res.get('req_limit', None) req_limit = res.get('req_limit', None)
self.cache[api_key] = req_limit
else: else:
req_limit = False req_limit = None
self.cache[api_key] = False self.cache[api_key] = req_limit
return req_limit return req_limit