-
Notifications
You must be signed in to change notification settings - Fork 37
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
Error due to IP address switch #92
Comments
there is a known bug with IPv6 and link local address in the pythons request module (python/cpython#73561). it should be fixed in upcoming release of python 3.11 and 3.12 |
Thanks for the link. I will test it. |
I compiled Python 3.12.1, which should have the bugfix for the mentioned bug. Then I ran python-fritzhome from a virtual environment, but got the same error:
I tried both IPv6 addresses, which I got for the DNS name fritz.box, and it worked. But the IPv6 addresses did not work with python-fritzhome and the Python version 3.11.2. This problem seems to be fixed by the mentioned bug. I think, it is a problem in the underlying libraries (requests, urllib3 or httplib). |
I recently changed my Homeassistant hardware. Afterwards I was not able to use the FRITZ!SmartHome integration. I got the following error:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://fritz.box/webservices/homeautoswitch.lua?switchcmd=gettemplatelistinfos&sid=88a3e4bb76d62fe0
The Fritz!Box reports an failed log in. Tests with the CLI results in the same error, but not on my normal PC. It seems to be similar to the problem of the following report.
Further investigation using wireshard revealed the problem:
The used IPv6 address changed between the different request and the address needs to be the same, otherwise the request failes.
My first idea was to get the source IP address of the first request and set it for further connections. But getting the source address is tricky and did not work with the Fritz!Box (further information).
I came up with the following quick and dirty solution in
fritzhome.py
:Do you have an idea for a better solution? Especially for integration into pyfritzhome.
Some background on the environment: Raspberry Pi OS Lite 64 based on Debian 12 with the IP addresses assigned via DHCP.
The text was updated successfully, but these errors were encountered: