Return truethy when there are no data, but connection has been succeed
This commit is contained in:
@@ -201,7 +201,7 @@ class SensorDockApp(wmdocklib.DockApp):
|
|||||||
if (self._data.get('_last_update') and
|
if (self._data.get('_last_update') and
|
||||||
(now - self._data['_last_update']).seconds < 7500):
|
(now - self._data['_last_update']).seconds < 7500):
|
||||||
# don't hammer npb service to often
|
# don't hammer npb service to often
|
||||||
return
|
return True
|
||||||
|
|
||||||
for currency in self.conf.get('currencies'):
|
for currency in self.conf.get('currencies'):
|
||||||
url = (f'http://api.nbp.pl/api/exchangerates/rates/a/{currency}/'
|
url = (f'http://api.nbp.pl/api/exchangerates/rates/a/{currency}/'
|
||||||
@@ -214,7 +214,7 @@ class SensorDockApp(wmdocklib.DockApp):
|
|||||||
if response.status_code != 200:
|
if response.status_code != 200:
|
||||||
print(f'error requesting data for currency "{currency} on '
|
print(f'error requesting data for currency "{currency} on '
|
||||||
f'time range between {start_date} and {end_date}')
|
f'time range between {start_date} and {end_date}')
|
||||||
return
|
return True
|
||||||
|
|
||||||
self._data['_last_update'] = now
|
self._data['_last_update'] = now
|
||||||
result = response.json()
|
result = response.json()
|
||||||
|
|||||||
Reference in New Issue
Block a user