Skip to content

Url

class Url

build(secure_password=False)

Build str-representation of the url

Parameters:

Name Type Description Default
secure_password bool

password will be hidden if it's True

False

Returns:

Type Description
str

str-representation of the url

contains_auth() property

Check that url contains auth part

Returns:

Type Description
bool

True if username and password are not None

copy_with(protocol=_EMPTY, host=_EMPTY, port=_EMPTY, username=_EMPTY, password=_EMPTY, path=_EMPTY, query=_EMPTY)

Copy url with new attributes

Parameters:

Name Type Description Default
protocol _PROTOCOL_T

scheme

_EMPTY
host str

host

_EMPTY
port _PORT_T

port

_EMPTY
username str | None

username

_EMPTY
password str | None

password

_EMPTY
path Path

path

_EMPTY
query dict

query

_EMPTY

Returns:

Type Description
Url

new url

host() property

Host getter

Returns:

Type Description
str

host

join_path(path)

Join path to url

Parameters:

Name Type Description Default
path Path

additional path

required

Returns:

Type Description
Url

new url

parse(raw_url) classmethod

Parse string-url to Url

Parameters:

Name Type Description Default
raw_url str

string url

required

Returns:

Type Description
Url

parsed Url

password() property

Password getter

Returns:

Type Description
str | None

password

path() property

Path getter

Returns:

Type Description
Path

url path

port() property

Port getter

Returns:

Type Description
_PORT_T

port

protocol() property

Protocol getter

Returns:

Type Description
_PROTOCOL_T

protocol

query() property

Query getter

Returns:

Type Description
MappingProxyType[str, str]

unmodifiable view of query

update_query(query)

Update query part of the url

Parameters:

Name Type Description Default
query StrDict

dict of query parameters

required

Returns:

Type Description
Url

new url

username() property

Username getter

Returns:

Type Description
str | None

username