I have the following piece of code in Java:
RequestConfig.custom().setSocketTimeout(10).setConnectTimeout(20).build();
How do I achieve the same thing in Python?
I have the following piece of code in Java:
RequestConfig.custom().setSocketTimeout(10).setConnectTimeout(20).build();
How do I achieve the same thing in Python?
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 callsettimeout()
before callingconnect()
or pass a timeout parameter tocreate_connection()
. The system network stack may return a connection timeout error of its own regardless of any Python socket timeout setting.