Skip to content

Instantly share code, notes, and snippets.

@thejungwon
Last active March 26, 2020 15:36
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 thejungwon/70084a5307839ffc3b12f8809d0a7454 to your computer and use it in GitHub Desktop.
Save thejungwon/70084a5307839ffc3b12f8809d0a7454 to your computer and use it in GitHub Desktop.
import requests
from concurrent.futures import ThreadPoolExecutor
def get_url(url):
return requests.get(url)
list_of_urls = ["https://postman-echo.com/get?foo1=bar1&foo2=bar2"]*10
with ThreadPoolExecutor(max_workers=10) as pool:
response_list = list(pool.map(get_url,list_of_urls))
for response in response_list:
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment