e-data
Advanced tools
+24
| import typer | ||
| from getpass import getpass | ||
| from edata.connectors.datadis import DatadisConnector | ||
| import json | ||
| def main(): | ||
| """CLI básica para mostrar supplies y contracts de Datadis.""" | ||
| username = typer.prompt("Usuario (NIF)") | ||
| password = getpass("Contraseña: ") | ||
| connector = DatadisConnector(username, password) | ||
| supplies = connector.get_supplies() | ||
| typer.echo("\nSupplies:") | ||
| typer.echo(json.dumps(supplies, indent=2, default=str)) | ||
| if supplies: | ||
| cups = supplies[0]["cups"] | ||
| distributor = supplies[0]["distributorCode"] | ||
| contracts = connector.get_contract_detail(cups, distributor) | ||
| typer.echo("\nContracts:") | ||
| typer.echo(json.dumps(contracts, indent=2, default=str)) | ||
| else: | ||
| typer.echo("No se encontraron supplies.") | ||
| if __name__ == "__main__": | ||
| typer.run(main) |
| Metadata-Version: 2.4 | ||
| Name: e-data | ||
| Version: 1.3.2 | ||
| Version: 1.3.3 | ||
| Summary: Python library for managing spanish energy data from various web providers | ||
@@ -5,0 +5,0 @@ Author-email: VMG <vmayorg@outlook.es> |
@@ -11,2 +11,3 @@ LICENSE | ||
| edata/__init__.py | ||
| edata/cli.py | ||
| edata/const.py | ||
@@ -13,0 +14,0 @@ edata/definitions.py |
@@ -146,4 +146,4 @@ """Datadis API connector. | ||
| data={ | ||
| TOKEN_USERNAME: self._usr.encode("utf-8"), | ||
| TOKEN_PASSWD: self._pwd.encode("utf-8"), | ||
| TOKEN_USERNAME: self._usr, | ||
| TOKEN_PASSWD: self._pwd, | ||
| }, | ||
@@ -227,3 +227,3 @@ ) as response: | ||
| try: | ||
| json_data = await reply.json() | ||
| json_data = await reply.json(content_type=None) | ||
| if json_data: | ||
@@ -237,3 +237,3 @@ response = json_data | ||
| self._update_recent_queries(url + params) | ||
| except Exception: | ||
| except Exception as e: | ||
| _LOGGER.warning("Failed to parse JSON response") | ||
@@ -240,0 +240,0 @@ elif reply.status == 401 and not refresh_token: |
+1
-1
| Metadata-Version: 2.4 | ||
| Name: e-data | ||
| Version: 1.3.2 | ||
| Version: 1.3.3 | ||
| Summary: Python library for managing spanish energy data from various web providers | ||
@@ -5,0 +5,0 @@ Author-email: VMG <vmayorg@outlook.es> |
+1
-1
@@ -7,3 +7,3 @@ [build-system] | ||
| name = "e-data" | ||
| version = "1.3.2" | ||
| version = "1.3.3" | ||
| description = "Python library for managing spanish energy data from various web providers" | ||
@@ -10,0 +10,0 @@ readme = "README.md" |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
233495
0.36%31
3.33%2411
0.92%