Advertisement
dereksir

Untitled

Jan 3rd, 2024 (edited)
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.52 KB | None | 0 0
  1. import urllib3
  2. import time
  3.  
  4. # create a PoolManager instance
  5. http = urllib3.PoolManager()
  6.  
  7. start_time = time.time()  # record the start time
  8. response = http.request('GET', 'https://httpbin.org') # make the get request
  9. end_time = time.time()    # record the end time
  10.  
  11. # calculate the time taken
  12. elapsed_time = end_time - start_time
  13.  
  14. # Optionally, do something with the response and the time taken
  15. # print(f"Response: {response.data}")
  16. print(f"Time taken: {elapsed_time} seconds")
  17.  
  18.  
  19.  
  20. #.. Time taken: 1.02 seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement