mirror of https://github.com/scrapy/scrapy.git
28 lines
515 B
Python
28 lines
515 B
Python
from scrapy import Request, Spider
|
|
from scrapy.crawler import AsyncCrawlerProcess
|
|
|
|
|
|
class DataSpider(Spider):
|
|
name = "data"
|
|
|
|
async def start(self):
|
|
yield Request("data:,foo")
|
|
|
|
def parse(self, response):
|
|
return {"data": response.text}
|
|
|
|
|
|
process = AsyncCrawlerProcess(
|
|
settings={
|
|
"TWISTED_ENABLED": False,
|
|
"DOWNLOAD_HANDLERS": {
|
|
"http": None,
|
|
"https": None,
|
|
"ftp": None,
|
|
},
|
|
}
|
|
)
|
|
|
|
process.crawl(DataSpider)
|
|
process.start()
|