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

[Feature Request] Allow setting timeout #19

Closed cbasix closed 4 years ago

cbasix commented 4 years ago

It would be great if it where possible to set the timeouts for outgoing http requests (and therefore for the used requests module and lxml).

Motivation: i do have a use case where i would prefer the FritzConnection to fall rather than to stall the execution for two minutes.

Minimal Example:

start = datetime.now()
try:
    fc = FritzConnection("google.com")
finally:
    print(datetime.now()-start)

Output: 0:02:00.105666

kbr commented 4 years ago

I never thought about a use case like this. But as requests provides timeout, it makes sense to add this feature. Will come with the next release (1.1).

cbasix commented 4 years ago

Thanks for your effort. Works like a charm.