From 78fc7ebf1f658ccf174ba135fec5f7fae519b961 Mon Sep 17 00:00:00 2001 From: Hector Espert Date: Sat, 21 Jun 2025 10:25:34 +0200 Subject: [PATCH 1/3] Fix login usgin mobile headers --- oligo/requests/iber.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/oligo/requests/iber.py b/oligo/requests/iber.py index 446618e..e6db7d3 100644 --- a/oligo/requests/iber.py +++ b/oligo/requests/iber.py @@ -28,10 +28,15 @@ class Iber: __obtener_periodo_generacion_url = __domain + "/consumidores/rest/consumoNew/obtenerDatosGeneracionPeriodo/fechaInicio/{}00:00:00/fechaFinal/{}00:00:00/" # date format: 07-11-2020 - that's 7 Nov 2020 __headers = { - 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/77.0.3865.90 Chrome/77.0.3865.90 Safari/537.36", - 'accept': "application/json; charset=utf-8", - 'content-type': "application/json; charset=utf-8", - 'cache-control': "no-cache" + "Content-Type": "application/json; charset=utf-8", + "esVersionNueva": "1", + "idioma": "es", + "movilAPP": "si", + "tipoAPP": "ios", + "User-Agent": ( + "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) " + "AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77" + ), } def __init__(self, session=None): @@ -41,8 +46,19 @@ def __init__(self, session=None): def login(self, user, password, session=Session()): """Creates session with your credentials""" self.__session = session - login_data = "[\"{}\",\"{}\",null,\"Linux -\",\"PC\",\"Chrome 77.0.3865.90\",\"0\",\"\",\"s\"]".format(user, password) - response = self.__session.request("POST", self.__login_url, data=login_data, headers=self.__headers) + login_data = [ + user, + password, + "", + "Android 6.0", + "Móvil", + "Chrome 119.0.0.0", + "0", + "", + "s", + "", + ] + response = self.__session.request("POST", self.__login_url, headers=self.__headers, json=login_data) if response.status_code != 200: self.__session = None raise ResponseException(response.status_code) From c2d3d66a309fd1aa4fb2524d57d4ac06c6c8f471 Mon Sep 17 00:00:00 2001 From: Hector Espert Date: Sat, 21 Jun 2025 10:29:56 +0200 Subject: [PATCH 2/3] Add python 3.12 --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7251c61..a414148 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.8.10' + python-version: '3.12' - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 06c6061..d57e4ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v4 From c389e41a7808178f773bb6c07ead0d71d6acbd8e Mon Sep 17 00:00:00 2001 From: Hector Espert Date: Sat, 21 Jun 2025 10:31:42 +0200 Subject: [PATCH 3/3] Update the readme --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index d307c17..9ac0eca 100644 --- a/README.md +++ b/README.md @@ -118,9 +118,6 @@ Los datos son el consumo por hora en Watt-horas. En este caso tendremos los dato de una semana, que son 7 por 24, 168 valores. Si sumamos y dividimos por 1000, tenemos el consumo de una semana en kWh. -### Integraciones: -- Integración para Home Assistan: [ad-ha/ide_api](https://github.com/ad-ha/ide_api) - ## [EN] Python client (UNOFFICIAL) for i-DE (Iberdrola distribución). ### Install: