How to measure server response time for Python requests POST-request? -


i create requests post-requests this, specify timeout threshold:

response = requests.post(url, data=post_fields, timeout=timeout)

however, determine "good" threshold value, benchmark server response time in advance.

how compute minimum , maximum response times server?

the response object returned requests.post() has property called elapsed, give give time delta between request sent , response received. number of seconds, use total_seconds() method:

response = requests.post(url, data=post_fields, timeout=timeout) print(response.elapsed.total_seconds()) 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -