This file contains hidden or 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 time | |
| import requests | |
| from concurrent.futures import ThreadPoolExecutor | |
| url_list = ['https://docs.python.org/3/library/concurrent.futures.html',\ | |
| 'https://technokeeda.com', | |
| 'http://home.pipeline.com/~hbaker1/Futures.html'] | |
| def get_sequential_get(urls): | |
| """ | |
| Function which does a get requests |
This file contains hidden or 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
| currs.shutdown(wait=True) |
This file contains hidden or 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
| for url in urls: | |
| curr_future_result = currs.submit(worker_func, url, results) |
This file contains hidden or 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
| currs = ThreadPoolExecutor(max_workers=5) |
This file contains hidden or 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
| currs.shutdown(wait=True) |
This file contains hidden or 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 | |
| url_list = ['https://docs.python.org/3/library/concurrent.futures.html', \ | |
| 'https://technokeeda.com', \ | |
| 'http://home.pipeline.com/~hbaker1/Futures.html'] | |
| def get_futures_get(urls): | |
| results = [] | |
| currs = ThreadPoolExecutor(max_workers=5) | |
| for url in urls: |
This file contains hidden or 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 | |
| # need to get all the urls | |
| url_list = ['https://docs.python.org/3/library/concurrent.futures.html', | |
| 'https://technokeeda.com', | |
| 'http://home.pipeline.com/~hbaker1/Futures.html'] | |
| for url in url_list: | |
| response = requests.get(url) | |
| print(response, response.status_code) |
This file contains hidden or 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
| url_list = ['https://docs.python.org/3/library/concurrent.futures.html', | |
| 'https://technokeeda.com', | |
| 'http://home.pipeline.com/~hbaker1/Futures.html'] |
This file contains hidden or 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
| url_list = ['https://docs.python.org/3/library/concurrent.futures.html', | |
| 'https://technokeeda.com', | |
| 'http://home.pipeline.com/~hbaker1/Futures.html'] |
This file contains hidden or 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
| 0x3df2b419a2974328a92371b236e2c1e49b665016 |