scrapy.utils.python.to_native_str.split - python examples

Here are the examples of the python api scrapy.utils.python.to_native_str.split taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

3 View Complete Implementation : responsetypes.py
Copyright MIT License
Author : wistbean
    def from_content_type(self, content_type, content_encoding=None):
        """Return the most appropriate Response clast from an HTTP Content-Type
        header """
        if content_encoding:
            return Response
        mimetype = to_native_str(content_type).split(';')[0].strip().lower()
        return self.from_mimetype(mimetype)

3 View Complete Implementation : responsetypes.py
Copyright MIT License
Author : wistbean
    def from_content_disposition(self, content_disposition):
        try:
            filename = to_native_str(content_disposition,
                encoding='latin-1', errors='replace').split(';')[1].split('=')[1]
            filename = filename.strip('"\'')
            return self.from_filename(filename)
        except IndexError:
            return Response