[modules/getcrypto] Deal with kraken service downtime

see #222
This commit is contained in:
Tobias Witek 2018-01-11 20:29:45 +01:00
parent 5f96b603a8
commit 3615e60e5b
3 changed files with 10 additions and 2 deletions

View file

@ -34,6 +34,8 @@ def getfromkrak(coin, currency):
krakenget = requests.get('https://api.kraken.com/0/public/Ticker?pair='+epair).json()
except (RequestException, Exception):
return "No connection"
if not 'result' in krakenget:
return "No data"
kethusdask = float(krakenget['result'][tickname]['a'][0])
kethusdbid = float(krakenget['result'][tickname]['b'][0])
return coin+": "+str((kethusdask+kethusdbid)/2)[0:6]