Skip to content

Instantly share code, notes, and snippets.

@heartonbit
Last active May 4, 2018 04:16
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 heartonbit/e230b2b58db84a9c5247009a3c2e0fd8 to your computer and use it in GitHub Desktop.
Save heartonbit/e230b2b58db84a9c5247009a3c2e0fd8 to your computer and use it in GitHub Desktop.
import concurrent.futures
def do(params):
return "hello"
with concurrent.futures.ThreadPoolExecutor(max_workers=5) as executor:
future = executor.submit(do, params)
for future in concurrent.futures.as_completed(future_to_url):
url = future_to_url[future]
try:
data = future.result()
except Exception as exc:
print('%r generated an exception: %s' % (url, exc))
else:
print('%r page is %d bytes' % (url, len(data)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment