-
Notifications
You must be signed in to change notification settings - Fork 99
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
Allow to define request timeout #14
Comments
Great idea. I think this can be accomplished with the requests module. I will start playing with this... Thanks! |
I don't have much knowledge in Python, but maybe this will help: http://docs.python-requests.org/en/master/user/quickstart/#timeouts |
I'd also like to add that if the module can't reach the UniFi Controller, in the case of the integration with Home Assistant, it causes the entire app to block, and without any noticeable error message. Took a while to find it. Should be as simple as adding a "timeout=x" entry to each of the calls to requests. I've got a locally edited version of controller.py, i'll see about getting a pull request over to you. |
This is the pull request I came up with: #15 |
Currently this library doesn't seem to support setting a request timeout. In case the Unifi Controller is not responding, a script using this library is waiting infinitely.
In my case I'm using this library in a small local check for Check_MK to monitor my access points. If the Unifi Controller is not responding, every check will start an additional Python process waiting for the Unifi Controller to respond which will soon end in having hundreds of processes waiting for the Unifi Controller.
Could you please add the possibility to specify the timeout for the API requests?
The text was updated successfully, but these errors were encountered: