mirror of https://github.com/scrapy/scrapy.git
21 lines
387 B
Python
21 lines
387 B
Python
import asyncio
|
|
import sys
|
|
|
|
import scrapy
|
|
from scrapy.crawler import AsyncCrawlerProcess
|
|
|
|
|
|
class SleepingSpider(scrapy.Spider):
|
|
name = "sleeping"
|
|
|
|
start_urls = ["data:,;"]
|
|
|
|
async def parse(self, response):
|
|
await asyncio.sleep(int(sys.argv[1]))
|
|
|
|
|
|
process = AsyncCrawlerProcess(settings={"TWISTED_REACTOR_ENABLED": False})
|
|
|
|
process.crawl(SleepingSpider)
|
|
process.start()
|