e-data 1.2.11__tar.gz → 1.2.13__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.11/e_data.egg-info → e-data-1.2.13}/PKG-INFO +1 -1
  2. {e-data-1.2.11 → e-data-1.2.13/e_data.egg-info}/PKG-INFO +1 -1
  3. {e-data-1.2.11 → e-data-1.2.13}/edata/helpers.py +17 -10
  4. {e-data-1.2.11 → e-data-1.2.13}/setup.py +1 -1
  5. {e-data-1.2.11 → e-data-1.2.13}/LICENSE +0 -0
  6. {e-data-1.2.11 → e-data-1.2.13}/MANIFEST.in +0 -0
  7. {e-data-1.2.11 → e-data-1.2.13}/README.md +0 -0
  8. {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/SOURCES.txt +0 -0
  9. {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/dependency_links.txt +0 -0
  10. {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/requires.txt +0 -0
  11. {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/top_level.txt +0 -0
  12. {e-data-1.2.11 → e-data-1.2.13}/edata/__init__.py +0 -0
  13. {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/__init__.py +0 -0
  14. {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/datadis.py +0 -0
  15. {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/redata.py +0 -0
  16. {e-data-1.2.11 → e-data-1.2.13}/edata/const.py +0 -0
  17. {e-data-1.2.11 → e-data-1.2.13}/edata/definitions.py +0 -0
  18. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/__init__.py +0 -0
  19. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/base.py +0 -0
  20. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/billing.py +0 -0
  21. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/consumption.py +0 -0
  22. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/maximeter.py +0 -0
  23. {e-data-1.2.11 → e-data-1.2.13}/edata/processors/utils.py +0 -0
  24. {e-data-1.2.11 → e-data-1.2.13}/edata/storage.py +0 -0
  25. {e-data-1.2.11 → e-data-1.2.13}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e-data
3
- Version: 1.2.11
3
+ Version: 1.2.13
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.11
3
+ Version: 1.2.13
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
@@ -58,6 +58,7 @@ class EdataHelper:
58
58
  self._date_from = datetime(1970, 1, 1)
59
59
  self._date_to = datetime.today()
60
60
  self._must_dump = True
61
+ self._incremental_update = True
61
62
 
62
63
  if data is not None:
63
64
  data = check_storage_integrity(data)
@@ -107,6 +108,7 @@ class EdataHelper:
107
108
  self,
108
109
  date_from: datetime = datetime(1970, 1, 1),
109
110
  date_to: datetime = datetime.today(),
111
+ incremental_update: bool = True,
110
112
  ):
111
113
  """Synchronous update."""
112
114
  self._date_from = date_from
@@ -122,7 +124,7 @@ class EdataHelper:
122
124
  except requests.exceptions.Timeout:
123
125
  _LOGGER.error("Timeout exception while updating from REData")
124
126
 
125
- self.process_data()
127
+ self.process_data(incremental_update=incremental_update)
126
128
 
127
129
  if self._must_dump:
128
130
  dump_storage(self._cups, self.data, self._storage_dir)
@@ -380,8 +382,11 @@ class EdataHelper:
380
382
 
381
383
  return True
382
384
 
383
- def process_data(self):
385
+ def process_data(self, incremental_update: bool = True):
384
386
  """Process all raw data."""
387
+
388
+ self._incremental_update = incremental_update
389
+
385
390
  for process_method in [
386
391
  self.process_supplies,
387
392
  self.process_contracts,
@@ -423,10 +428,12 @@ class EdataHelper:
423
428
  def process_consumptions(self):
424
429
  """Process consumptions data."""
425
430
  if len(self.data["consumptions"]) > 0:
426
- try:
427
- new_data_from = self.data["consumptions_monthly_sum"][-1]["datetime"]
428
- except Exception:
429
- new_data_from = self._date_from
431
+ new_data_from = self._date_from
432
+ if self._incremental_update:
433
+ with contextlib.suppress(Exception):
434
+ new_data_from = self.data["consumptions_monthly_sum"][-1][
435
+ "datetime"
436
+ ]
430
437
 
431
438
  proc = ConsumptionProcessor(
432
439
  {
@@ -624,10 +631,10 @@ class EdataHelper:
624
631
  def process_cost(self):
625
632
  """Process costs."""
626
633
  if self.enable_billing:
627
- try:
628
- new_data_from = self.data["cost_monthly_sum"][-1]["datetime"]
629
- except Exception:
630
- new_data_from = self._date_from
634
+ new_data_from = self._date_from
635
+ if self._incremental_update:
636
+ with contextlib.suppress(Exception):
637
+ new_data_from = self.data["cost_monthly_sum"][-1]["datetime"]
631
638
 
632
639
  proc = BillingProcessor(
633
640
  BillingInput(
@@ -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.11"
23
+ VERSION = "1.2.13"
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