Last active
May 4, 2018 04:16
-
-
Save heartonbit/e230b2b58db84a9c5247009a3c2e0fd8 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 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