exchange_rate: fix issue caused by lack of testing
@@ -44,16 +44,15 @@ class Py3status:
)
self.rates_data = {currency: '?' for currency in self.currencies}
- def rates(self):
+ def exchange_rate(self):
try:
- result = self.py3.request(
+ data = self.py3.request(
URL, timeout=self.request_timeout
- )
+ ).json()
except self.py3.RequestException:
- result = None
+ data = None
+ if data:
rates = {}
- if result:
- data = result.json()
for item in data:
rates[item['currency_code']] = item['rate']
base_rate = 1.0 / rates.get(self.base)
