scrapy 怎么看运行时间
时间: 2023-09-17 20:06:34 浏览: 80
查看电脑运行时间
5星 · 资源好评率100%
Scrapy默认会在控制台输出运行时间,例如:
```
2019-08-30 11:58:45 [scrapy.core.engine] INFO: Spider opened
2019-08-30 11:58:45 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2019-08-30 11:58:45 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
2019-08-30 11:58:45 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.example.com> (referer: None)
2019-08-30 11:58:46 [scrapy.core.engine] INFO: Closing spider (finished)
2019-08-30 11:58:46 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{'downloader/request_bytes': 226,
'downloader/request_count': 1,
'downloader/request_method_count/GET': 1,
'downloader/response_bytes': 45429,
'downloader/response_count': 1,
'downloader/response_status_count/200': 1,
'elapsed_time_seconds': 0.673051,
'finish_reason': 'finished',
'finish_time': datetime.datetime(2019, 8, 30, 3, 58, 46, 265718),
'log_count/DEBUG': 1,
'log_count/INFO': 10,
'response_received_count': 1,
'scheduler/dequeued': 1,
'scheduler/dequeued/memory': 1,
'scheduler/enqueued': 1,
'scheduler/enqueued/memory': 1,
'start_time': datetime.datetime(2019, 8, 30, 3, 58, 45, 592667)}
```
其中,`elapsed_time_seconds`就是运行时间,单位为秒。
阅读全文