["python","python-3.x","server","network-programming","python-requests"]
How to measure server response time for Python requests POST-request

I create POST requests with requests as follows, with a specified timeout threshold: response = requests.post(url, data=post_fields, timeout=timeout) However, to determine a "good" threshold, I need to benchmark the server response times. How do I compute the minimum and maximum response times for the server?
The Response object returned by requests.post() (and requests.get() etc.) has a property called elapsed, which provides the time delta between the Request was sent and the Response was received. To get the delta in seconds, use the total_seconds() method: response = requests.post(url, data=post_fields, timeout=timeout) print(response.elapsed.total_seconds()) Note that requests.post() is a synchronous operation, which means that it blocks until the Response is received.