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
| # adapted from: | |
| # https://stackoverflow.com/questions/48677978/python-run-multiple-get-requests-in-parallel-and-stop-on-first-response | |
| from multiprocessing import Queue, Process | |
| from multiprocessing.queues import Empty | |
| from time import sleep | |
| def f1(queue): | |
| print('f1') |
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
| def funcao_1(self, url): | |
| scrapy.Request(url, callback=download_pdf) | |
| return list(requests) | |
| def parse(self, response): | |
| retorno = funcao_1() | |
| for r in retorno: | |
| yield r | |
| self.funcao_2() | |
| self.funcao_3() |