mirror of
https://github.com/aljazceru/plugins.git
synced 2025-12-24 00:24:19 +01:00
summary: fix bitstamp api 404
This commit is contained in:
committed by
Christian Decker
parent
5d274f67c4
commit
2a798864f8
@@ -61,7 +61,14 @@ class PriceThread(threading.Thread):
|
|||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
# NOTE: Bitstamp has a DNS/Proxy issues that can return 404
|
||||||
|
# Workaround: retry up to 5 times with a delay
|
||||||
|
for _ in range(5):
|
||||||
r = requests.get('https://www.bitstamp.net/api/v2/ticker/BTC{}'.format(plugin.currency), proxies=self.proxies)
|
r = requests.get('https://www.bitstamp.net/api/v2/ticker/BTC{}'.format(plugin.currency), proxies=self.proxies)
|
||||||
|
if not r.status_code == 200:
|
||||||
|
time.sleep(1)
|
||||||
|
continue
|
||||||
|
break
|
||||||
plugin.fiat_per_btc = float(r.json()['last'])
|
plugin.fiat_per_btc = float(r.json()['last'])
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
plugin.log("[PriceThread] " + str(ex), 'warn')
|
plugin.log("[PriceThread] " + str(ex), 'warn')
|
||||||
|
|||||||
Reference in New Issue
Block a user