natekspencer / pylitterbot

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

AttributeError: 'NoneType' object has no attribute 'get' #238

Open slapcat opened 1 month ago

slapcat commented 1 month ago

I run this script on a cronjob about every 30 mins. Around 2:30pm today it started giving this error every time:

Traceback (most recent call last):
  File "/root/litterbox.py", line 37, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/root/litterbox.py", line 16, in main
    await account.connect(username=username, password=password, load_robots=True)
  File "/usr/local/lib/python3.10/dist-packages/pylitterbot/account.py", line 103, in connect
    await self.load_robots(subscribe_for_updates)
  File "/usr/local/lib/python3.10/dist-packages/pylitterbot/account.py", line 184, in load_robots
    for robot_data in resp[2].get("data").get("feeder_unit") or []:
AttributeError: 'NoneType' object has no attribute 'get'

Has the API changed?

thomasnorris commented 1 month ago

I am experiencing the same issue. It looks like the last time that I ran this script successfully today was at 2:03pm ET.

natekspencer commented 1 month ago

It looks like they switched to using Cognito auth and have swapped out the feeder graphql endpoint. I'm working on a fix, but need to test