For a small app that monitors a webserver I need to collect the response time. Here is my code snippet:
start = time.process_time()
response = requests.post(url, timeout=3.0)
request_time = time.process_time() - start
print("Request completed in: " + str(request_time*1000))
print(response.elapsed.total_seconds()*100)
The response time is recorded in two different ways (record time before and after request and get difference; response.elapsed.total_seconds()) as I wanted to try both. The output is different. So, which is the correct way to measure the response time?