diff --git a/source/jormungandr/jormungandr/parking_space_availability/bss/jcdecaux.py b/source/jormungandr/jormungandr/parking_space_availability/bss/jcdecaux.py index 80b920a7ba..29b93899c6 100644 --- a/source/jormungandr/jormungandr/parking_space_availability/bss/jcdecaux.py +++ b/source/jormungandr/jormungandr/parking_space_availability/bss/jcdecaux.py @@ -110,16 +110,14 @@ def _get_informations(self, poi): ref = poi.get('properties', {}).get('ref') service_key = self.WS_URL_TEMPLATE.format(self.contract, self.api_key) + self.network data = self._data.get(service_key) - if data is None: + if ( + data is None + or self._last_update + datetime.timedelta(seconds=self._update_interval) < datetime.datetime.utcnow() + ): self._data[service_key] = self._call_webservice() self._last_update = datetime.datetime.utcnow() + data = self._data.get(service_key) - if self._last_update + datetime.timedelta(seconds=self._update_interval) < datetime.datetime.utcnow(): - service_url = self.WS_URL_TEMPLATE.format(self.contract, self.api_key) - self._data[service_url] = self._call_webservice() - self._last_update = datetime.datetime.utcnow() - - data = self._data.get(service_key) if data and 'status' in data.get(ref, {}): if data[ref]['status'] == 'OPEN': return Stands(