natekspencer / pylitterbot

Python package for controlling a Whisker connected self-cleaning litter boxes and feeders
MIT License
87 stars 12 forks source link

LitterRobotException of "Unable to login to litter-robot." started on August 22nd 2023 #184

Closed alv53 closed 1 year ago

alv53 commented 1 year ago

Hey, I've been using this API to keep track of my litter robot 3 for a bit now, and keep logs of a python script of my own running, and noticed that it stopped working in August. From my logs I can see

Here is a full stack trace on manually running my own python script.

PS C:\Users\alvjo\dev\lrwatcher> python .\lr.py
Traceback (most recent call last):
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\account.py", line 75, in connect
    await self.refresh_user()
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\account.py", line 96, in refresh_user
    data = cast(dict, await self.session.get(urljoin(DEFAULT_ENDPOINT, "users")))
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\session.py", line 42, in get
    return await self.request("GET", path, **kwargs)
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\session.py", line 212, in request
    return await super().request(method, url, **kwargs)
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\session.py", line 100, in request
    resp.raise_for_status()
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\aiohttp\client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://v2.api.whisker.iothings.site/users')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\alvjo\dev\lrwatcher\lr.py", line 150, in <module>
    asyncio.run(main())
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\alvjo\dev\lrwatcher\lr.py", line 80, in main
    await account.connect(username=username, password=password, load_robots=True)
  File "C:\Users\alvjo\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\pylitterbot\account.py", line 82, in connect
    raise LitterRobotException("Unable to login to Litter-Robot.") from ex
pylitterbot.exceptions.LitterRobotException: Unable to login to Litter-Robot.
alv53 commented 1 year ago

Nevermind, doing a pip install pylitterbot --upgrade appears to have resolved it.