Snippet content copied to clipboard.
Are you sure to delete this snippet? No, don't delete
  1. with ThreadPoolExecutor(max_workers=NUM_CONCURRENT) as executor:
  2. futures = {executor.submit(send_request, idx, url, data, headers) for idx, data in enumerate(data_list , 1)}
  3. to_exit = False
  4. for future_set in concurrent.futures.wait(futures, return_when=concurrent.futures.FIRST_EXCEPTION):
  5. for f in future_set:
  6. if f.exception():
  7. to_exit = True
  8. break
  9. if to_exit:
  10. break

Edit this Snippet