Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import urllib3
- import time
- # create a PoolManager instance
- http = urllib3.PoolManager()
- start_time = time.time() # record the start time
- response = http.request('GET', 'https://httpbin.org') # make the get request
- end_time = time.time() # record the end time
- # calculate the time taken
- elapsed_time = end_time - start_time
- # Optionally, do something with the response and the time taken
- # print(f"Response: {response.data}")
- print(f"Time taken: {elapsed_time} seconds")
- #.. Time taken: 1.02 seconds
- ###..... Requests Test .....###
- import requests
- import time
- start_time = time.time() # record the start time
- response = requests.get('https://httpbin.org') # make GET request
- end_time = time.time() # record the end time
- # calculate the time taken
- elapsed_time = end_time - start_time
- # optionally, do something with the response and the time taken
- # print(f"Response: {response.data}")
- print(f"Time taken: {elapsed_time} seconds")
- #... Time taken: 1.07.. seconds
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement