demo_requests_post_timeout.py:
import requests url = 'https://w3schools.com/python/demopage.php' myobj = {'somekey': 'somevalue'} #to demonstrate the 'timeout' parameter, we set the timeout to 0.001 to guarantee that the connection will be timed out: x = requests.post(url, data = myobj, timeout=0.001) print(x.text)
C:\Users\My Name>python demo_requests_post_timeout.py
Connection to w3schools.com timed out. (connect timeout=0.001)