Skip to content
Merged
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
15 changes: 12 additions & 3 deletions roborock/web_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ async def request_code_v4(self) -> None:
code_response = await code_request.request(
"post",
"/api/v4/email/code/send",
params={"email": self._username, "type": "login", "platform": ""},
data={"email": self._username, "type": "login", "platform": ""},
)
if code_response is None:
raise RoborockException("Failed to get a response from send email code")
Expand Down Expand Up @@ -316,12 +316,21 @@ async def code_login_v4(
login_request = PreparedRequest(
base_url,
self.session,
{"header_clientid": header_clientid, "x-mercy-ks": x_mercy_ks, "x-mercy-k": x_mercy_k},
{
"header_clientid": header_clientid,
"x-mercy-ks": x_mercy_ks,
"x-mercy-k": x_mercy_k,
"Content-Type": "application/x-www-form-urlencoded",
"header_clientlang": "en",
"header_appversion": "4.54.02",
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The hardcoded app version "4.54.02" may become outdated as the Roborock app is updated. Consider adding a comment explaining why this specific version is used, or if possible, making it configurable to ensure future compatibility with the API.

Copilot uses AI. Check for mistakes.
"header_phonesystem": "iOS",
"header_phonemodel": "iPhone16,1",
},
Comment on lines +323 to +328
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

Consider adding a comment explaining why these specific header values (Content-Type, language "en", phone system "iOS", phone model "iPhone16,1") are required for the V4 API. This would help future maintainers understand if these values need to be adjusted or made configurable.

Copilot uses AI. Check for mistakes.
)
login_response = await login_request.request(
"post",
"/api/v4/auth/email/login/code",
params={
data={
"country": country,
"countryCode": country_code,
"email": self._username,
Expand Down