Skip to content

Instantly share code, notes, and snippets.

@abhirama
Created March 31, 2020 07:17
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/bc5ea44164b4ca6f3f77edd5ff5d0640 to your computer and use it in GitHub Desktop.
Save abhirama/bc5ea44164b4ca6f3f77edd5ff5d0640 to your computer and use it in GitHub Desktop.
import requests
from multiprocessing import Process
from timeit import default_timer as timer
def call():
r = requests.get("https://httpbin.org/drip?duration=30&delay=0", timeout=(6.4, 20))
p = Process(target=call)
start = timer()
p.start()
p.join(timeout=20)
p.terminate()
end = timer()
print("Time spent waiting for the response - ", end - start, "Seconds")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment