The Python query library only supports connect timeout and read
http://docs.python-requests.org/en/master/user/advanced/#timeouts
It is not possible to force a timeout when a DNS lookup takes a very long time. I would like to start a timeout when it takes more than X seconds to complete the GET request (including DNS, connect and read).
Please note that I cannot use the signal approach , as it only works in the main thread.
I am looking for an elegant solution.
source
share