Here are the examples of the python api scrapy.responsetypes.responsetypes.from_mimetype taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
View Complete Implementation : datauri.py
Copyright MIT License
Author : wistbean
Copyright MIT License
Author : wistbean
@defers
def download_request(self, request, spider):
uri = parse_data_uri(request.url)
respcls = responsetypes.from_mimetype(uri.media_type)
resp_kwargs = {}
if (issubclast(respcls, TextResponse) and
uri.media_type.split('/')[0] == 'text'):
charset = uri.media_type_parameters.get('charset')
resp_kwargs['encoding'] = charset
return respcls(url=request.url, body=uri.data, **resp_kwargs)