Skip to content

Fix login using mobile headers#47

Merged
hectorespert merged 3 commits intomasterfrom
fix_login
Jun 21, 2025
Merged

Fix login using mobile headers#47
hectorespert merged 3 commits intomasterfrom
fix_login

Conversation

@hectorespert
Copy link
Owner

@hectorespert hectorespert commented Jun 21, 2025

Fix login using mobile headers like https://github.com/ldotlopez/ideenergy

Fixes #46

@hectorespert hectorespert changed the title Fix login usgin mobile headers Fix login using mobile headers Jun 21, 2025
@hectorespert hectorespert requested a review from Copilot June 21, 2025 08:26
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the Iber client to use mobile-specific headers and sends the login payload as a JSON list rather than a raw string.

  • Replaced desktop headers with mobile-focused headers (iOS user-agent and app flags)
  • Transformed login_data from a formatted string to a Python list
  • Switched the request call to use json=login_data instead of data
Comments suppressed due to low confidence (2)

oligo/requests/iber.py:59

  • An extra empty string is appended at the end of login_data. Confirm that the API expects this trailing element; otherwise, it may cause login failures.
            "",

oligo/requests/iber.py:31

  • Since you're using json=login_data, requests will set the Content-Type header automatically. You can remove this manual header to avoid redundancy.
        "Content-Type": "application/json; charset=utf-8",

Comment on lines +49 to +60
login_data = [
user,
password,
"",
"Android 6.0",
"Móvil",
"Chrome 119.0.0.0",
"0",
"",
"s",
"",
]
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.
@hectorespert hectorespert merged commit 437f76b into master Jun 21, 2025
4 checks passed
@hectorespert hectorespert deleted the fix_login branch June 21, 2025 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problema iniciar sesion

1 participant

Comments