class documentation

class BaseURL(_URLTuple):

Known subclasses: werkzeug.urls.BytesURL, werkzeug.urls.URL

View In Hierarchy

Superclass of URL and BytesURL.
Method __str__ Undocumented
Method decode​_netloc Decodes the netloc part into a string.
Method decode​_query Decodes the query part of the URL. Ths is a shortcut for calling url_decode on the query argument. The arguments and keyword arguments are forwarded to url_decode unchanged.
Method encode​_netloc Encodes the netloc part to an ASCII safe URL as bytes.
Method get​_file​_location 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.
Method join Joins this URL with another one. This is just a convenience function for calling into url_join and then parsing the return value again.
Method replace Return an URL with the same values, except for those parameters given new values by whichever keyword arguments are specified.
Method to​_iri​_tuple No summary
Method to​_uri​_tuple Returns a 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.
Method to​_url Returns a URL string or bytes depending on the type of the information stored. This is just a convenience function for calling url_unparse for this URL.
Class Variable __slots__ Undocumented
Property ascii​_host No summary
Property auth The authentication part in the URL if available, None otherwise.
Property host 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.
Property password The password if it was part of the URL, None otherwise. This undergoes URL decoding and will always be a string.
Property port The port in the URL as an integer if it was present, None otherwise. This does not fill in default ports.
Property raw​_password The password if it was part of the URL, None otherwise. Unlike password this one is not being decoded.
Property raw​_username The username if it was part of the URL, None otherwise. Unlike username this one is not being decoded.
Property username The username if it was part of the URL, None otherwise. This undergoes URL decoding and will always be a string.
Method ​_split​_auth Undocumented
Method ​_split​_host Undocumented
Method ​_split​_netloc Undocumented
Class Variable ​_at Undocumented
Class Variable ​_colon Undocumented
Class Variable ​_lbracket Undocumented
Class Variable ​_rbracket Undocumented

Inherited from _URLTuple:

Class Variable fragment Undocumented
Class Variable netloc Undocumented
Class Variable path Undocumented
Class Variable query Undocumented
Class Variable scheme Undocumented
def __str__(self):

Undocumented

Returns
strUndocumented
def decode_netloc(self):
Decodes the netloc part into a string.
Returns
strUndocumented
def decode_query(self, *args, **kwargs):
Decodes the query part of the URL. Ths is a shortcut for calling url_decode on the query argument. The arguments and keyword arguments are forwarded to url_decode unchanged.
Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
Returns
ds.MultiDict[str, str]Undocumented
def encode_netloc(self):
Encodes the netloc part to an ASCII safe URL as bytes.
Returns
strUndocumented
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.

Parameters
pathformat:t.Optional[str]The expected format of the path component. Currently 'windows' and 'posix' are supported. Defaults to None which is autodetect.
Returns
t.Tuple[t.Optional[str], t.Optional[str]]Undocumented
def join(self, *args, **kwargs):
Joins this URL with another one. This is just a convenience function for calling into url_join and then parsing the return value again.
Parameters
*args:t.AnyUndocumented
**kwargs:t.AnyUndocumented
Returns
BaseURLUndocumented
def replace(self, **kwargs):
Return an URL with the same values, except for those parameters given new values by whichever keyword arguments are specified.
Parameters
**kwargs:t.AnyUndocumented
Returns
BaseURLUndocumented
def to_iri_tuple(self):

Returns a 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 uri_to_iri which will return a string.

Returns
BaseURLUndocumented
def to_uri_tuple(self):

Returns a 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 iri_to_uri which will return a string.

Returns
BaseURLUndocumented
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 url_unparse for this URL.
Returns
strUndocumented
__slots__: tuple =

Undocumented

@property
ascii_host: t.Optional[str] =
Works exactly like 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.
@property
auth: t.Optional[str] =
The authentication part in the URL if available, None otherwise.
@property
host: t.Optional[str] =
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.
@property
password: t.Optional[str] =
The password if it was part of the URL, None otherwise. This undergoes URL decoding and will always be a string.
@property
port: t.Optional[int] =
The port in the URL as an integer if it was present, None otherwise. This does not fill in default ports.
@property
raw_password: t.Optional[str] =
The password if it was part of the URL, None otherwise. Unlike password this one is not being decoded.
@property
raw_username: t.Optional[str] =
The username if it was part of the URL, None otherwise. Unlike username this one is not being decoded.
@property
username: t.Optional[str] =
The username if it was part of the URL, None otherwise. This undergoes URL decoding and will always be a string.
def _split_auth(self):

Undocumented

Returns
t.Tuple[t.Optional[str], t.Optional[str]]Undocumented
def _split_host(self):

Undocumented

Returns
t.Tuple[t.Optional[str], t.Optional[str]]Undocumented
def _split_netloc(self):

Undocumented

Returns
t.Tuple[t.Optional[str], str]Undocumented
_at: str =

Undocumented

_colon: str =

Undocumented

_lbracket: str =

Undocumented

_rbracket: str =

Undocumented