forked from mirrors/LibreTranslate
return None on failed remote key lookup
This commit is contained in:
parent
ed68f1bcf9
commit
47fc85fdec
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue