mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
[fix] encapsulate wolframalpha token fetching errors
This commit is contained in:
parent
d06178139f
commit
db72fc6449
@ -44,9 +44,12 @@ token = {'value': '',
|
|||||||
# seems, wolframalpha resets its token in every hour
|
# seems, wolframalpha resets its token in every hour
|
||||||
def obtain_token():
|
def obtain_token():
|
||||||
update_time = time() - (time() % 3600)
|
update_time = time() - (time() % 3600)
|
||||||
|
try:
|
||||||
token_response = http_get('https://www.wolframalpha.com/input/api/v1/code?ts=9999999999999999999', timeout=2.0)
|
token_response = http_get('https://www.wolframalpha.com/input/api/v1/code?ts=9999999999999999999', timeout=2.0)
|
||||||
token['value'] = loads(token_response.text)['code']
|
token['value'] = loads(token_response.text)['code']
|
||||||
token['last_updated'] = update_time
|
token['last_updated'] = update_time
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return token
|
return token
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user