Sajid Sajid - 1 year ago 61
HTTP Question

What is the Python equivalent of RequestConfig in Java?

I have the following piece of code in Java:


How do I achieve the same thing in Python?

Answer Source

Please, take a look to this answer where is shown how to set timeout.

It results from documentation that setSocketTimeout and setConnectTimeout are the same things in Python.

Note that the connect() operation is subject to the timeout setting, and in general it is recommended to call settimeout() before calling connect() or pass a timeout parameter to create_connection(). The system network stack may return a connection timeout error of its own regardless of any Python socket timeout setting.