Scrapy request+response+download time

前端 未结 3 1543
忘了有多久
忘了有多久 2021-02-14 01:28

UPD: Not close question because I think my way is not so clear as should be

Is it possible to get current request + response + download time for saving

3条回答
  •  不要未来只要你来
    2021-02-14 02:08

    You could write a Downloader Middleware which would time each request. It would add a start time to the request before it's made and then a finish time when it's finished. Typically, arbitrary data such as this is stored in the Request.meta attribute. This timing information could later be read by your spider and added to your item.

    This downloader middleware sounds like it could be useful on many projects.

提交回复
热议问题