e-data 1.2.20__tar.gz → 1.2.22__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {e_data-1.2.20/e_data.egg-info → e_data-1.2.22}/PKG-INFO +1 -1
  2. {e_data-1.2.20 → e_data-1.2.22/e_data.egg-info}/PKG-INFO +1 -1
  3. {e_data-1.2.20 → e_data-1.2.22}/edata/connectors/datadis.py +6 -4
  4. {e_data-1.2.20 → e_data-1.2.22}/edata/helpers.py +25 -0
  5. {e_data-1.2.20 → e_data-1.2.22}/setup.py +1 -1
  6. {e_data-1.2.20 → e_data-1.2.22}/LICENSE +0 -0
  7. {e_data-1.2.20 → e_data-1.2.22}/MANIFEST.in +0 -0
  8. {e_data-1.2.20 → e_data-1.2.22}/README.md +0 -0
  9. {e_data-1.2.20 → e_data-1.2.22}/e_data.egg-info/SOURCES.txt +0 -0
  10. {e_data-1.2.20 → e_data-1.2.22}/e_data.egg-info/dependency_links.txt +0 -0
  11. {e_data-1.2.20 → e_data-1.2.22}/e_data.egg-info/requires.txt +0 -0
  12. {e_data-1.2.20 → e_data-1.2.22}/e_data.egg-info/top_level.txt +0 -0
  13. {e_data-1.2.20 → e_data-1.2.22}/edata/__init__.py +0 -0
  14. {e_data-1.2.20 → e_data-1.2.22}/edata/connectors/__init__.py +0 -0
  15. {e_data-1.2.20 → e_data-1.2.22}/edata/connectors/redata.py +0 -0
  16. {e_data-1.2.20 → e_data-1.2.22}/edata/const.py +0 -0
  17. {e_data-1.2.20 → e_data-1.2.22}/edata/definitions.py +0 -0
  18. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/__init__.py +0 -0
  19. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/base.py +0 -0
  20. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/billing.py +0 -0
  21. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/consumption.py +0 -0
  22. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/maximeter.py +0 -0
  23. {e_data-1.2.20 → e_data-1.2.22}/edata/processors/utils.py +0 -0
  24. {e_data-1.2.20 → e_data-1.2.22}/edata/storage.py +0 -0
  25. {e_data-1.2.20 → e_data-1.2.22}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e-data
3
- Version: 1.2.20
3
+ Version: 1.2.22
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Home-page: https://github.com/uvejota/python-edata
6
6
  Author: VMG
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e-data
3
- Version: 1.2.20
3
+ Version: 1.2.22
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Home-page: https://github.com/uvejota/python-edata
6
6
  Author: VMG
@@ -75,8 +75,8 @@ def migrate_storage(storage_dir):
75
75
  """Migrate storage from older versions."""
76
76
 
77
77
  with contextlib.suppress(FileNotFoundError):
78
- os.remove(storage_dir, "edata_recent_queries.json")
79
- os.remove(storage_dir, "edata_recent_queries_cache.json")
78
+ os.remove(os.path.join(storage_dir, "edata_recent_queries.json"))
79
+ os.remove(os.path.join(storage_dir, "edata_recent_queries_cache.json"))
80
80
 
81
81
 
82
82
  class DatadisConnector:
@@ -160,7 +160,7 @@ class DatadisConnector:
160
160
  try:
161
161
  with open(cache_file, encoding="utf8") as cache:
162
162
  return json.load(cache)
163
- except FileNotFoundError:
163
+ except (FileNotFoundError, json.decoder.JSONDecodeError):
164
164
  return None
165
165
 
166
166
  def _get_token(self):
@@ -234,7 +234,9 @@ class DatadisConnector:
234
234
  if not ignore_recent_queries and self._is_recent_query(url + params):
235
235
  _cache = self._get_cache_for_query(url + params)
236
236
  if _cache is not None:
237
- _LOGGER.info("Returning cached data")
237
+ _LOGGER.info(
238
+ "Returning cached response for '%s'", url + anonym_params
239
+ )
238
240
  return _cache
239
241
  return []
240
242
 
@@ -212,6 +212,8 @@ class EdataHelper:
212
212
  self.data["consumptions"], consumptions, "datetime"
213
213
  )
214
214
  self.last_update["consumptions"] = datetime.now()
215
+ else:
216
+ _LOGGER.info("%s: consumptions are up to date", self._scups)
215
217
  else:
216
218
  _LOGGER.info("%s: consumptions are already updated (skipping)", self._scups)
217
219
 
@@ -236,6 +238,8 @@ class EdataHelper:
236
238
  self.data["maximeter"], maximeter, "datetime"
237
239
  )
238
240
  self.last_update["maximeter"] = datetime.now()
241
+ else:
242
+ _LOGGER.info("%s: maximeter is up to date", self._scups)
239
243
  else:
240
244
  _LOGGER.info("%s: maximeter is already updated (skipping)", self._scups)
241
245
 
@@ -742,3 +746,24 @@ class EdataHelper:
742
746
 
743
747
  if last_month is not None:
744
748
  self.attributes["last_month_€"] = last_month.get("value_eur", None)
749
+
750
+ def reset(self):
751
+ """Reset in-mem objects."""
752
+
753
+ self.data = EdataData(
754
+ supplies=[],
755
+ contracts=[],
756
+ consumptions=[],
757
+ maximeter=[],
758
+ pvpc=[],
759
+ consumptions_daily_sum=[],
760
+ consumptions_monthly_sum=[],
761
+ cost_hourly_sum=[],
762
+ cost_daily_sum=[],
763
+ cost_monthly_sum=[],
764
+ )
765
+
766
+ for attr in ATTRIBUTES:
767
+ self.attributes[attr] = None
768
+
769
+ self.last_update = {x: datetime(1970, 1, 1) for x in self.data}
@@ -20,7 +20,7 @@ URL = "https://github.com/uvejota/python-edata"
20
20
  EMAIL = "vmayorg@outlook.es"
21
21
  AUTHOR = "VMG"
22
22
  REQUIRES_PYTHON = ">=3.6.0"
23
- VERSION = "1.2.20"
23
+ VERSION = "1.2.22"
24
24
 
25
25
  # What packages are required for this module to be executed?
26
26
  REQUIRED = [
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes