Skip to content

Instantly share code, notes, and snippets.

@abhirama
Created March 31, 2020 06:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abhirama/fee259e76d875e528aee32755ef76f1e to your computer and use it in GitHub Desktop.
Save abhirama/fee259e76d875e528aee32755ef76f1e to your computer and use it in GitHub Desktop.
import requests
from timeit import default_timer as timer
from requests import exceptions as e
try:
start = timer()
r = requests.get("https://httpbin.org/delay/9", timeout=(6.4, 6))
except e.ReadTimeout:
end = timer()
print("Timed out after", end - start, "Seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment