From 493d4c22410a676715c5f0a6f14e58f27a0982b5 Mon Sep 17 00:00:00 2001 From: gryf Date: Thu, 15 Feb 2024 14:40:12 +0100 Subject: [PATCH] Return truethy when there are no data, but connection has been succeed --- pywmcurrencies/pywmcurrencies.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pywmcurrencies/pywmcurrencies.py b/pywmcurrencies/pywmcurrencies.py index 583b72f..111aea1 100755 --- a/pywmcurrencies/pywmcurrencies.py +++ b/pywmcurrencies/pywmcurrencies.py @@ -201,7 +201,7 @@ class SensorDockApp(wmdocklib.DockApp): if (self._data.get('_last_update') and (now - self._data['_last_update']).seconds < 7500): # don't hammer npb service to often - return + return True for currency in self.conf.get('currencies'): url = (f'http://api.nbp.pl/api/exchangerates/rates/a/{currency}/' @@ -214,7 +214,7 @@ class SensorDockApp(wmdocklib.DockApp): if response.status_code != 200: print(f'error requesting data for currency "{currency} on ' f'time range between {start_date} and {end_date}') - return + return True self._data['_last_update'] = now result = response.json()