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 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: 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)