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
Post a Comment