kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

timeout parameter does not seem to work. #63

Closed bb-Ricardo closed 3 years ago

bb-Ricardo commented 3 years ago

Hi,

just trying to switch to current version of your awesome library and wanted to add the timeout setting.

During testing I discovered that the timeout param seems to have no effect.

2020-07-30 12:18:04,034 - INFO: Done parsing config file
2020-07-30 12:18:04,034 - INFO: Connection timeout setting: 2
2020-07-30 12:18:04,042 - DEBUG: Starting new HTTP connection (1): 192.168.178.2:49000
2020-07-30 12:19:19,082 - ERROR: Failed to connect to FritzBox 'HTTPConnectionPool(host='192.168.178.2', port=49000): Max retries exceeded with url: /igddesc.xml (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1022ea190>: Failed to establish a new connection: [Errno 60] Operation timed out'))'

I see that the timeout is passed on to requests here: https://github.com/kbr/fritzconnection/blob/master/fritzconnection/core/soaper.py#L241

but for some reason it is not honored.

kbr commented 3 years ago

Well, I can reproduce this – in case that the ip is invalid. Does the router really listen at 192.168.178.2 ?

bb-Ricardo commented 3 years ago

Nope. This is an unused IP address to test if timeout really works.

Schould't it work with an invalid IP Address?

Does requests support this behavior? Not even sure.

kbr commented 3 years ago

Sorry, seems to be that I have been mentally on the wrong track. I know that it has worked at time of implementation. May be it's broken meanwhile without notice. Currently I have no idea whether it's a request issue or not, have to dive into this. Already have an eye on httpx.

kbr commented 3 years ago

Resolved with version 1.3.4 Thank you for reporting.

bb-Ricardo commented 3 years ago

Awesome, thank you.