Skip to content

Instantly share code, notes, and snippets.

@thejungwon
Created March 26, 2020 15:42
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/ef7cdcce8876a23258fb6b724ece3fc9 to your computer and use it in GitHub Desktop.
Save thejungwon/ef7cdcce8876a23258fb6b724ece3fc9 to your computer and use it in GitHub Desktop.
import requests
from concurrent.futures import ThreadPoolExecutor
def post_url(args):
return requests.post(args[0], data=args[1])
form_data = {
"foo1":"bar1",
"foo2":"bar2"
}
list_of_urls = [("https://postman-echo.com/post",form_data)]*10
with ThreadPoolExecutor(max_workers=10) as pool:
response_list = list(pool.map(post_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