Last active
March 26, 2020 15:36
-
-
Save thejungwon/70084a5307839ffc3b12f8809d0a7454 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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