From 04ce2de228441628508cf92a6735315498901214 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Thu, 11 Jan 2018 20:32:15 +0100 Subject: [PATCH] [modules/getcrypto] Handle missing results --- bumblebee/modules/getcrypto.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bumblebee/modules/getcrypto.py b/bumblebee/modules/getcrypto.py index 502e100..d75b373 100644 --- a/bumblebee/modules/getcrypto.py +++ b/bumblebee/modules/getcrypto.py @@ -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]