OpenQuizz
Une application de gestion des contenus pédagogiques
BaseURL Class Reference
Inheritance diagram for BaseURL:
Collaboration diagram for BaseURL:

Public Member Functions

def replace (self, **kwargs)
 
def host (self)
 
def ascii_host (self)
 
def port (self)
 
def auth (self)
 
def username (self)
 
def raw_username (self)
 
def password (self)
 
def raw_password (self)
 
def decode_query (self, *args, **kwargs)
 
def join (self, *args, **kwargs)
 
def to_url (self)
 
def decode_netloc (self)
 
def to_uri_tuple (self)
 
def to_iri_tuple (self)
 
def get_file_location (self, pathformat=None)
 

Detailed Description

Superclass of :py:class:`URL` and :py:class:`BytesURL`.

Member Function Documentation

◆ ascii_host()

def ascii_host (   self)
Works exactly like :attr:`host` but will return a result that
is restricted to ASCII.  If it finds a netloc that is not ASCII
it will attempt to idna decode it.  This is useful for socket
operations when the URL might include internationalized characters.

◆ auth()

def auth (   self)
The authentication part in the URL if available, `None`
otherwise.

◆ decode_netloc()

def decode_netloc (   self)
Decodes the netloc part into a string.

◆ decode_query()

def decode_query (   self,
args,
**  kwargs 
)
Decodes the query part of the URL.  Ths is a shortcut for
calling :func:`url_decode` on the query argument.  The arguments and
keyword arguments are forwarded to :func:`url_decode` unchanged.

◆ get_file_location()

def get_file_location (   self,
  pathformat = None 
)
Returns a tuple with the location of the file in the form
``(server, location)``.  If the netloc is empty in the URL or
points to localhost, it's represented as ``None``.

The `pathformat` by default is autodetection but needs to be set
when working with URLs of a specific system.  The supported values
are ``'windows'`` when working with Windows or DOS paths and
``'posix'`` when working with posix paths.

If the URL does not point to a local file, the server and location
are both represented as ``None``.

:param pathformat: The expected format of the path component.
           Currently ``'windows'`` and ``'posix'`` are
           supported.  Defaults to ``None`` which is
           autodetect.

◆ host()

def host (   self)
The host part of the URL if available, otherwise `None`.  The
host is either the hostname or the IP address mentioned in the
URL.  It will not contain the port.

◆ join()

def join (   self,
args,
**  kwargs 
)
Joins this URL with another one.  This is just a convenience
function for calling into :meth:`url_join` and then parsing the
return value again.

◆ password()

def password (   self)
The password if it was part of the URL, `None` otherwise.
This undergoes URL decoding and will always be a unicode string.

◆ port()

def port (   self)
The port in the URL as an integer if it was present, `None`
otherwise.  This does not fill in default ports.

◆ raw_password()

def raw_password (   self)
The password if it was part of the URL, `None` otherwise.
Unlike :attr:`password` this one is not being decoded.

◆ raw_username()

def raw_username (   self)
The username if it was part of the URL, `None` otherwise.
Unlike :attr:`username` this one is not being decoded.

◆ replace()

def replace (   self,
**  kwargs 
)
Return an URL with the same values, except for those parameters
given new values by whichever keyword arguments are specified.

◆ to_iri_tuple()

def to_iri_tuple (   self)
Returns a :class:`URL` tuple that holds a IRI.  This will try
to decode as much information as possible in the URL without
losing information similar to how a web browser does it for the
URL bar.

It's usually more interesting to directly call :meth:`uri_to_iri` which
will return a string.

◆ to_uri_tuple()

def to_uri_tuple (   self)
Returns a :class:`BytesURL` tuple that holds a URI.  This will
encode all the information in the URL properly to ASCII using the
rules a web browser would follow.

It's usually more interesting to directly call :meth:`iri_to_uri` which
will return a string.

◆ to_url()

def to_url (   self)
Returns a URL string or bytes depending on the type of the
information stored.  This is just a convenience function
for calling :meth:`url_unparse` for this URL.

◆ username()

def username (   self)
The username if it was part of the URL, `None` otherwise.
This undergoes URL decoding and will always be a unicode string.

The documentation for this class was generated from the following file: