mirror of https://github.com/scrapy/scrapy.git
PY3 MimeTypes wants files in text mode.
See http://hg.python.org/cpython/file/2766320bdb10/Lib/mimetypes.py#l202 before: 455 failed, 248 passed, 10 skipped, 8 warnings, 55 error in 88.36 seconds after: 466 failed, 253 passed, 12 skipped, 8 warnings, 49 error in 90.15 seconds
This commit is contained in:
parent
7cd271eb8e
commit
40cc875d6d
|
|
@ -6,7 +6,7 @@ based on different criteria.
|
|||
|
||||
from mimetypes import MimeTypes
|
||||
from pkgutil import get_data
|
||||
from io import BytesIO
|
||||
from io import StringIO
|
||||
import six
|
||||
|
||||
from scrapy.http import Response
|
||||
|
|
@ -33,8 +33,8 @@ class ResponseTypes(object):
|
|||
def __init__(self):
|
||||
self.classes = {}
|
||||
self.mimetypes = MimeTypes()
|
||||
mimedata = get_data('scrapy', 'mime.types')
|
||||
self.mimetypes.readfp(BytesIO(mimedata))
|
||||
mimedata = get_data('scrapy', 'mime.types').decode('utf8')
|
||||
self.mimetypes.readfp(StringIO(mimedata))
|
||||
for mimetype, cls in six.iteritems(self.CLASSES):
|
||||
self.classes[mimetype] = load_object(cls)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue