Woyken / py-electrolux-ocp

Electrolux OCP api using electrolux OneApp (pyelectroluxocp) https://api.ocp.electrolux.one
https://pypi.org/project/pyelectroluxocp/
MIT License
26 stars 2 forks source link

Error with a user during authentication #7

Open albaintor opened 6 months ago

albaintor commented 6 months ago

Hi @Woyken ,

I have received this issue from a user https://github.com/albaintor/homeassistant_electrolux_status/issues/28#issuecomment-1943761943

The error comes gigyaClient. I am not really aware of its goal, it seems to extract info based on the user region ?

File "/config/custom_components/electrolux_status/electroluxwrapper/gigyaClient.py", line 147, in get_ids data: SocializeGetIdsResponse = await response.json(content_type=None)

Thank you for your help

Woyken commented 6 months ago

Hey, it's probably responding with some error status code. Can you try updating the library, I recently updated it to throw on status code error from Gigya. I found out reading their documentation that there is a header you pass in to either always return status 200 or allow "normal error" status codes too.

I noticed you are using copied older version that always expects success. If you update we might get some more details on what is happening

Woyken commented 6 months ago

Although it looks like it can't parse Json, either response body is not valid Json or is empty, so I'm not sure if it'll help. I'll try some different requests, what the response could be in few hours on my side

albaintor commented 6 months ago

Hi, The response is empty in this case from the logs : "File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None"

Woyken commented 6 months ago

Looks like I had GET and POST requests mixed up for get_ids() gigya request, not sure why it even worked sometimes. Fixed that. Also added a bunch more error logging. If request fails to parse JSON. will output what ever it received as text(), and a bunch more stuff, should be easier to spot the problem.

Released version: 0.0.12

albaintor commented 6 months ago

Ok thank you. You also changed the user agent to make the request always pass ? I will then switch back to an external dependency instead of wrapping it

Woyken commented 6 months ago

Yes, I added user agent header: "pyelectroluxocp/VERSION"