summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-02-17 17:21:54 +0100
committerAdam Tauber <asciimoo@gmail.com>2016-02-17 17:21:54 +0100
commitdb72fc64498963adcfe412aa9d203a9de4d78d79 (patch)
tree5e48a8ec56cc3e643bac0cd53e04d0c41dc8f9bb /searx
parentd06178139f141ae5c6e1908ca70de37371d3572d (diff)
downloadsearxng-db72fc64498963adcfe412aa9d203a9de4d78d79.tar.gz
searxng-db72fc64498963adcfe412aa9d203a9de4d78d79.zip
[fix] encapsulate wolframalpha token fetching errors
Diffstat (limited to 'searx')
-rw-r--r--searx/engines/wolframalpha_noapi.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/searx/engines/wolframalpha_noapi.py b/searx/engines/wolframalpha_noapi.py
index bffbbe466..3ebbc4196 100644
--- a/searx/engines/wolframalpha_noapi.py
+++ b/searx/engines/wolframalpha_noapi.py
@@ -44,9 +44,12 @@ token = {'value': '',
# seems, wolframalpha resets its token in every hour
def obtain_token():
update_time = time() - (time() % 3600)
- 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['last_updated'] = update_time
+ try:
+ 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['last_updated'] = update_time
+ except:
+ pass
return token