Measure website load time with Python requests
As for your question, it should be the total time for
- time to create the request object
- Send request
- Receive response
- Parse response (See comment from Thomas Orozco )
Other ways to measure a single request load time is to use urllib:
nf = urllib.urlopen(url)
start = time.time()
page = nf.read()
end = time.time()
nf.close()
# end - start gives you the page load time
There is such functionality in latest version of requests:
https://requests.readthedocs.io/en/latest/api/?highlight=elapsed#requests.Response.elapsed
For example:
requests.get("http://127.0.0.1").elapsed.total_seconds()