MCPcopy
hub / github.com/scrapy/scrapy / _file_downloaded

Method _file_downloaded

scrapy/pipelines/files.py:689–702  ·  view source on GitHub ↗
(
        self,
        response: Response,
        request: Request,
        info: MediaPipeline.SpiderInfo,
        *,
        item: Any = None,
    )

Source from the content-addressed store, hash-verified

687 self.crawler.stats.inc_value(f"file_status_count/{status}")
688
689 async def _file_downloaded(
690 self,
691 response: Response,
692 request: Request,
693 info: MediaPipeline.SpiderInfo,
694 *,
695 item: Any = None,
696 ) -> str:
697 path = self.file_path(request, response=response, info=info, item=item)
698 buf = BytesIO(response.body)
699 checksum = _md5sum(buf)
700 buf.seek(0)
701 await ensure_awaitable(self.store.persist_file(path, buf, info))
702 return checksum
703
704 # Overridable Interface
705 def get_media_requests(

Callers 1

file_downloadedMethod · 0.95

Calls 4

file_pathMethod · 0.95
ensure_awaitableFunction · 0.90
_md5sumFunction · 0.85
persist_fileMethod · 0.45

Tested by

no test coverage detected