Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cloud -v 3 the default #25

Closed
Phype opened this issue Apr 1, 2023 · 2 comments
Closed

Make cloud -v 3 the default #25

Phype opened this issue Apr 1, 2023 · 2 comments
Labels
bug Something isn't working enhancement New feature or request

Comments

@Phype
Copy link
Owner

Phype commented Apr 1, 2023

After some more testing, i guess we should make the new API the default.
I'll leave it to -v 2 for now for some more testing.

@Phype Phype added the enhancement New feature or request label Apr 1, 2023
@Phype Phype added the bug Something isn't working label Jun 22, 2023
@Phype
Copy link
Owner Author

Phype commented Jun 22, 2023

Seems the just disabled the old API:

$ python3 -m purei9_unofficial -d cloud -v2 -c <REDACTED> status
2023-06-22 13:54:40,392 - purei9_unofficial.util - DEBUG - HTTP POST https://api.delta.electrolux.com/api/Clients/Wellbeing
2023-06-22 13:54:40,393 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.delta.electrolux.com:443
2023-06-22 13:54:40,821 - urllib3.connectionpool - DEBUG - https://api.delta.electrolux.com:443 "POST /api/Clients/Wellbeing HTTP/1.1" 400 None
2023-06-22 13:54:40,823 - purei9_unofficial.util - DEBUG - HTTP 400 <Response [400]> {"code":400105,"codeDescription":"InvalidClientCredentials: The provided client credentials where not correct.","information":"invalid_client","message":"Bad request"}
2023-06-22 13:54:40,823 - purei9_unofficial.util - DEBUG - HTTP POST https://api.delta.electrolux.com/api/Clients/Wellbeing
2023-06-22 13:54:40,823 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.delta.electrolux.com:443
2023-06-22 13:54:41,097 - urllib3.connectionpool - DEBUG - https://api.delta.electrolux.com:443 "POST /api/Clients/Wellbeing HTTP/1.1" 400 None
2023-06-22 13:54:41,098 - purei9_unofficial.util - DEBUG - HTTP 400 <Response [400]> {"code":400105,"codeDescription":"InvalidClientCredentials: The provided client credentials where not correct.","information":"invalid_client","message":"Bad request"}
2023-06-22 13:54:41,099 - purei9_unofficial.util - DEBUG - HTTP POST https://api.delta.electrolux.com/api/Clients/Wellbeing
2023-06-22 13:54:41,100 - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.delta.electrolux.com:443
2023-06-22 13:54:41,351 - urllib3.connectionpool - DEBUG - https://api.delta.electrolux.com:443 "POST /api/Clients/Wellbeing HTTP/1.1" 400 None
2023-06-22 13:54:41,353 - purei9_unofficial.util - DEBUG - HTTP 400 <Response [400]> {"code":400105,"codeDescription":"InvalidClientCredentials: The provided client credentials where not correct.","information":"invalid_client","message":"Bad request"}
2023-06-22 13:54:41,354 - purei9_unofficial.util - ERROR - Giving up due to no left retries. Wrong credentials?
Traceback (most recent call last):
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.delta.electrolux.com/api/Clients/Wellbeing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.delta.electrolux.com/api/Clients/Wellbeing

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/__main__.py", line 161, in <module>
    robots = client.getRobots()
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/cloudv2.py", line 244, in getRobots
    r = do_http("GET", self.apiurl + "/Domains/Appliances", headers=self._getHeaders())
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/cloudv2.py", line 228, in _getHeaders
    r = do_http("POST", self.apiurl + "/Clients/" + self.client_id, json={"ClientSecret":self.client_secret})
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 26, in do_http
    return do_http(method, url, retries-1, **kwargs)
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 26, in do_http
    return do_http(method, url, retries-1, **kwargs)
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 29, in do_http
    raise r
  File "/home/philipp/purei9_unofficial/src/purei9_unofficial/util.py", line 22, in do_http
    r.raise_for_status()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.delta.electrolux.com/api/Clients/Wellbeing

cloud -v3 works fine. I'l make the change later.

The homeassistant air purifier intergration has the same problem: JohNan/homeassistant-wellbeing#53

@Phype
Copy link
Owner Author

Phype commented Oct 29, 2024

Fixed in fc4f41e

@Phype Phype closed this as completed Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant