Skip to content
Permalink
Browse files

explicit close file on file:// scheme handler

  • Loading branch information
dangra committed Dec 30, 2015
1 parent c0d0734 commit d9b4850c446f028131b0c2d78266f5ad48306b2c
Showing with 2 additions and 1 deletion.
  1. +2 −1 scrapy/core/downloader/handlers/file.py
@@ -10,6 +10,7 @@ def __init__(self, settings):
@defers
def download_request(self, request, spider):
filepath = file_uri_to_path(request.url)
body = open(filepath, 'rb').read()
with open(filepath, 'rb') as fo:
body = fo.read()
respcls = responsetypes.from_args(filename=filepath, body=body)
return respcls(url=request.url, body=body)

0 comments on commit d9b4850

Please sign in to comment.
You can’t perform that action at this time.