requests.utils.unquote

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

2 Examples 7

Example 1

Project: mopidy-pandora Source File: uri.py
Function: from_uri
    @classmethod
    def _from_uri(cls, uri):
        parts = [unquote(cls.encode(p)) for p in uri.split(':')]
        if not parts or parts[0] != PandoraUri.SCHEME or len(parts) < 2:
            raise NotImplementedError('Not a Pandora URI: {}'.format(uri))
        uri_cls = cls.TYPES.get(parts[1])
        if uri_cls:
            return uri_cls(*parts[2:])
        else:
            raise NotImplementedError("Unsupported Pandora URI type '{}'".format(uri))

Example 2

Project: ownNotes Source File: sync.py
    def get_files_index(self, path=''):
        index = {}

        abspath = self.get_abspath(path, asFolder=True)
        response = self.wc.propfind(uri=abspath,
                                    names=True,
                                    depth='1')
        # We can t use infinite depth some owncloud version
        # didn t support it

        if response.real == 207:
            for res in response:
                if len(res.get('resourcetype').getchildren()) == 0:
                    index[requests.utils.unquote(self.get_relpath(res.href))] \
                        = round(time.mktime(rfc822.parsedate(
                            res.get('getlastmodified').text)))
                else:
                    # Workarround for infinite depth
                    if res.href != abspath:
                        index.update(
                            self.get_files_index(
                                path=self.get_relpath(res.href)))

        elif response.real == 200:
            raise NetworkError('Wrong answer from server')

        else:
            raise NetworkError('Can\'t list file on webdav host')

        return index