Esempio n. 1
0
    def remove(url, **args):
        """Remove a dumped sample from a URL.

        :param str url:             The URL of the sample.
        :raises AttributeError:     If could not find specified ``scheme``,
                                    ``content_type`` or ``content_encoding``

        Read :py:meth:`load` for more information about keyword arguments and
        ``content_type`` or ``content_encoding`` guessing.
        """
        url = _urlparse(url)
        schemes.get(url.scheme).remove(url, **args)
Esempio n. 2
0
    def remove(url, **args):
        """Remove a dumped sample from a URL.

        :param str url:             The URL of the sample.
        :raises AttributeError:     If could not find specified ``scheme``,
                                    ``content_type`` or ``content_encoding``

        Read :py:meth:`load` for more information about keyword arguments and
        ``content_type`` or ``content_encoding`` guessing.
        """
        url = _urlparse(url)
        schemes.get(url.scheme).remove(url, **args)
Esempio n. 3
0
    def load(class_, url, **args):
        """Loads a sample from an URL.

        :param str url:             The URL of the sample.
        :returns:                   A ``class_`` instance.
        :raises AttributeError:     If could not find specified ``scheme``,
                                    ``content_type`` or ``content_encoding``

        Base keyword arguments:

        :content_type:
            Force the content to be handled as specified. The value of
            this keyword must be a string containig the internet media type
            that you want to be used: ``<type>/<sub-type>``. If this keyword
            argument is not specified, it will be guessed using the URL.
        :content_encoding:
            Force the content encoding to be handled as specified. By content
            encoding, basically, we mean compression method. If this keyword
            argument is not specified, it will be guessed using the URL.

        Other keyword arguments are passed to the handlers. See their
        respective documentation.

        By default, ``content_type`` and ``content_encoding`` guessing should
        be done by :py:func:`mimetypes.guess_type`.  Refer to each scheme
        documentation for more information.
        """
        url = _urlparse(url)
        return schemes.get(url.scheme).load(class_, url, **args)
Esempio n. 4
0
    def load(class_, url, **args):
        """Loads a sample from an URL.

        :param str url:             The URL of the sample.
        :returns:                   A ``class_`` instance.
        :raises AttributeError:     If could not find specified ``scheme``,
                                    ``content_type`` or ``content_encoding``

        Base keyword arguments:

        :content_type:
            Force the content to be handled as specified. The value of
            this keyword must be a string containig the internet media type
            that you want to be used: ``<type>/<sub-type>``. If this keyword
            argument is not specified, it will be guessed using the URL.
        :content_encoding:
            Force the content encoding to be handled as specified. By content
            encoding, basically, we mean compression method. If this keyword
            argument is not specified, it will be guessed using the URL.

        Other keyword arguments are passed to the handlers. See their
        respective documentation.

        By default, ``content_type`` and ``content_encoding`` guessing should
        be done by :py:func:`mimetypes.guess_type`.  Refer to each scheme
        documentation for more information.
        """
        url = _urlparse(url)
        return schemes.get(url.scheme).load(class_, url, **args)