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.
- {e-data-1.2.11/e_data.egg-info → e-data-1.2.13}/PKG-INFO +1 -1
- {e-data-1.2.11 → e-data-1.2.13/e_data.egg-info}/PKG-INFO +1 -1
- {e-data-1.2.11 → e-data-1.2.13}/edata/helpers.py +17 -10
- {e-data-1.2.11 → e-data-1.2.13}/setup.py +1 -1
- {e-data-1.2.11 → e-data-1.2.13}/LICENSE +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/MANIFEST.in +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/README.md +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/SOURCES.txt +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/dependency_links.txt +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/requires.txt +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/e_data.egg-info/top_level.txt +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/__init__.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/__init__.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/datadis.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/connectors/redata.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/const.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/definitions.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/__init__.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/base.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/billing.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/consumption.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/maximeter.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/processors/utils.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/edata/storage.py +0 -0
- {e-data-1.2.11 → e-data-1.2.13}/setup.cfg +0 -0
|
@@ -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
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
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
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
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(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|