benleb / surepy

🐾 Library & CLI to monitor and control the Pet Door & Cat Flap Connect 🚪 the Pet Feeder Connect 🍽 and the Felaqua 💦 sold by Sure Petcare
https://pypi.org/project/surepy/
MIT License
76 stars 36 forks source link

get_token() raise exception #169

Open Ashitaka57 opened 1 year ago

Ashitaka57 commented 1 year ago

Hello, recently I have this kind of errors. The API is unusable. I can't pinpoint where the problem lies. Did Surepetcare.io change anything on their side which need adaptation here?

🐾 · GET app.api.surehub.io/api/me/start: 401 | <ClientResponse(https://app.api.surehub.io/api/me/start) [401 Unauthorized]> <CIMultiDictProxy('Date': 'Sat, 03 Dec 2022 17:37:22 GMT', 'Content-Type': 'application/json', 'Content-Length': '63', 'Connection': 'keep-alive', 'Server': 'nginx', 'Cache-Control': 'no-cache, private', 'Access-Control-Allow-Origin': 'https://surepetcare.io', 'Vary': 'Origin', 'Content-Encoding': 'gzip', 'Strict-Transport-Security': 'max-age=31536000; includeSubdomains; preload', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'X-XSS-Protection': '1; mode=block')>

Traceback (most recent call last): if response := await self.sac.call(method="GET", resource=MESTART_RESOURCE): File "/surepy/client.py", line 266, in call await self.call(method="GET", resource=resource, second_try=True) File "/surepy/client.py", line 217, in call self._auth_token = await self.get_token() File "/surepy/client.py", line 187, in get_token raise SurePetcareError()

seems some other users encounter the same problems. https://github.com/benleb/sureha/issues/35

djvanhelmond commented 8 months ago

Same error here:

File "/opt/homebrew/lib/python3.11/site-packages/surepy/__init__.py", line 320, in get_devices
for device in (await self.get_entities()).values()
               ^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/surepy/__init__.py", line 358, in get_entities
  if response := await self.sac.call(method="GET", resource=MESTART_RESOURCE):
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/surepy/client.py", line 218, in call
  self._auth_token = await self.get_token()
                     ^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/surepy/client.py", line 188, in get_token
  raise SurePetcareError()
surepy.exceptions.SurePetcareError

Problem started Dec 12th, around 11AM UTC.

djvanhelmond commented 8 months ago

This is actually the same issue as described here in https://github.com/benleb/surepy/issues/199 (HTTP 415). This is a duplicate.