Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
28 changes: 22 additions & 6 deletions oligo/requests/iber.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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",
"",
]
Comment on lines +49 to +60
Copy link

Copilot AI Jun 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The login_data list relies on positional elements without documentation. Consider adding a comment describing each field or encapsulating this in a helper to clarify the payload structure.

Suggested change
login_data = [
user,
password,
"",
"Android 6.0",
"Móvil",
"Chrome 119.0.0.0",
"0",
"",
"s",
"",
]
login_data = self.__create_login_payload(user, password)

Copilot uses AI. Check for mistakes.
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)
Expand Down