e-data 1.3.2__tar.gz → 1.3.3__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 (31) hide show
  1. {e_data-1.3.2/e_data.egg-info → e_data-1.3.3}/PKG-INFO +1 -1
  2. {e_data-1.3.2 → e_data-1.3.3/e_data.egg-info}/PKG-INFO +1 -1
  3. {e_data-1.3.2 → e_data-1.3.3}/e_data.egg-info/SOURCES.txt +1 -0
  4. e_data-1.3.3/edata/cli.py +24 -0
  5. {e_data-1.3.2 → e_data-1.3.3}/edata/connectors/datadis.py +4 -4
  6. {e_data-1.3.2 → e_data-1.3.3}/pyproject.toml +1 -1
  7. {e_data-1.3.2 → e_data-1.3.3}/LICENSE +0 -0
  8. {e_data-1.3.2 → e_data-1.3.3}/MANIFEST.in +0 -0
  9. {e_data-1.3.2 → e_data-1.3.3}/README.md +0 -0
  10. {e_data-1.3.2 → e_data-1.3.3}/e_data.egg-info/dependency_links.txt +0 -0
  11. {e_data-1.3.2 → e_data-1.3.3}/e_data.egg-info/requires.txt +0 -0
  12. {e_data-1.3.2 → e_data-1.3.3}/e_data.egg-info/top_level.txt +0 -0
  13. {e_data-1.3.2 → e_data-1.3.3}/edata/__init__.py +0 -0
  14. {e_data-1.3.2 → e_data-1.3.3}/edata/connectors/__init__.py +0 -0
  15. {e_data-1.3.2 → e_data-1.3.3}/edata/connectors/redata.py +0 -0
  16. {e_data-1.3.2 → e_data-1.3.3}/edata/const.py +0 -0
  17. {e_data-1.3.2 → e_data-1.3.3}/edata/definitions.py +0 -0
  18. {e_data-1.3.2 → e_data-1.3.3}/edata/helpers.py +0 -0
  19. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/__init__.py +0 -0
  20. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/base.py +0 -0
  21. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/billing.py +0 -0
  22. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/consumption.py +0 -0
  23. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/maximeter.py +0 -0
  24. {e_data-1.3.2 → e_data-1.3.3}/edata/processors/utils.py +0 -0
  25. {e_data-1.3.2 → e_data-1.3.3}/edata/storage.py +0 -0
  26. {e_data-1.3.2 → e_data-1.3.3}/edata/tests/__init__.py +0 -0
  27. {e_data-1.3.2 → e_data-1.3.3}/edata/tests/test_datadis_connector.py +0 -0
  28. {e_data-1.3.2 → e_data-1.3.3}/edata/tests/test_helpers.py +0 -0
  29. {e_data-1.3.2 → e_data-1.3.3}/edata/tests/test_processors.py +0 -0
  30. {e_data-1.3.2 → e_data-1.3.3}/edata/tests/test_redata_connector.py +0 -0
  31. {e_data-1.3.2 → e_data-1.3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: e-data
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Author-email: VMG <vmayorg@outlook.es>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: e-data
3
- Version: 1.3.2
3
+ Version: 1.3.3
4
4
  Summary: Python library for managing spanish energy data from various web providers
5
5
  Author-email: VMG <vmayorg@outlook.es>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -8,6 +8,7 @@ e_data.egg-info/dependency_links.txt
8
8
  e_data.egg-info/requires.txt
9
9
  e_data.egg-info/top_level.txt
10
10
  edata/__init__.py
11
+ edata/cli.py
11
12
  edata/const.py
12
13
  edata/definitions.py
13
14
  edata/helpers.py
@@ -0,0 +1,24 @@
1
+ import typer
2
+ from getpass import getpass
3
+ from edata.connectors.datadis import DatadisConnector
4
+ import json
5
+
6
+ def main():
7
+ """CLI básica para mostrar supplies y contracts de Datadis."""
8
+ username = typer.prompt("Usuario (NIF)")
9
+ password = getpass("Contraseña: ")
10
+ connector = DatadisConnector(username, password)
11
+ supplies = connector.get_supplies()
12
+ typer.echo("\nSupplies:")
13
+ typer.echo(json.dumps(supplies, indent=2, default=str))
14
+ if supplies:
15
+ cups = supplies[0]["cups"]
16
+ distributor = supplies[0]["distributorCode"]
17
+ contracts = connector.get_contract_detail(cups, distributor)
18
+ typer.echo("\nContracts:")
19
+ typer.echo(json.dumps(contracts, indent=2, default=str))
20
+ else:
21
+ typer.echo("No se encontraron supplies.")
22
+
23
+ if __name__ == "__main__":
24
+ typer.run(main)
@@ -143,8 +143,8 @@ class DatadisConnector:
143
143
  async with session.post(
144
144
  URL_TOKEN,
145
145
  data={
146
- TOKEN_USERNAME: self._usr.encode("utf-8"),
147
- TOKEN_PASSWD: self._pwd.encode("utf-8"),
146
+ TOKEN_USERNAME: self._usr,
147
+ TOKEN_PASSWD: self._pwd,
148
148
  },
149
149
  ) as response:
150
150
  text = await response.text()
@@ -223,7 +223,7 @@ class DatadisConnector:
223
223
  if reply.status == 200:
224
224
  _LOGGER.info("Got 200 OK")
225
225
  try:
226
- json_data = await reply.json()
226
+ json_data = await reply.json(content_type=None)
227
227
  if json_data:
228
228
  response = json_data
229
229
  if not ignore_recent_queries:
@@ -232,7 +232,7 @@ class DatadisConnector:
232
232
  _LOGGER.info("Got an empty response")
233
233
  if not ignore_recent_queries:
234
234
  self._update_recent_queries(url + params)
235
- except Exception:
235
+ except Exception as e:
236
236
  _LOGGER.warning("Failed to parse JSON response")
237
237
  elif reply.status == 401 and not refresh_token:
238
238
  response = await self._async_get(
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "e-data"
7
- version = "1.3.2"
7
+ version = "1.3.3"
8
8
  description = "Python library for managing spanish energy data from various web providers"
9
9
  readme = "README.md"
10
10
  authors = [
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