natekspencer / pylitterbot

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

Failure to connect to API. Any tips? #127

Closed jacobmcclure closed 1 year ago

jacobmcclure commented 1 year ago

I'm not sure if the endpoint is broken or if I'm just doing something very incorrectly, but I'm unable to reach the api for some reason I am getting the following each time I attempt to authenticate:

`Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1092, in create_connection transport, protocol = await self._create_connection_transport( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1122, in _create_connection_transport await waiter File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 534, in data_received ssldata, appdata = self._sslpipe.feed_ssldata(data) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/sslproto.py", line 188, in feed_ssldata self._sslobj.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 975, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)

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

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/account.py", line 80, in connect await self.session.login(username=username, password=password) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/session.py", line 171, in login token = await self.post( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/session.py", line 46, in post return await self.request("POST", path, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/session.py", line 212, in request return await super().request(method, url, kwargs) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/session.py", line 80, in request async with self.websession.request(method, url, **kwargs) as resp: File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 1141, in aenter self._resp = await self._coro File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/client.py", line 536, in _request conn = await self._connector.connect( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 540, in connect proto = await self._create_connection(req, traces, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 901, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection raise last_exc File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection transp, proto = await self._wrap_create_connection( File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/aiohttp/connector.py", line 982, in _wrap_create_connection raise ClientConnectorCertificateError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host 42nk7qrhdg.execute-api.us-east-1.amazonaws.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')]

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

Traceback (most recent call last): File "/Users/jacob.mcclure/Desktop/lr3.py", line 28, in asyncio.run(main()) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/Users/jacob.mcclure/Desktop/lr3.py", line 16, in main await account.connect(username=username, password=password, load_robots=True) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pylitterbot/account.py", line 96, in connect raise LitterRobotException("Unable to reach the Litter-Robot api.") from ex pylitterbot.exceptions.LitterRobotException: Unable to reach the Litter-Robot api.`

Any idea what could be causing this? SOS

natekspencer commented 1 year ago

You probably need to check firewall rules to make sure traffic isn't blocked or disable IPv6 as that is known to cause issues, too.