URI

The URI object can be created from a parseable URI in a string, and unspecified attributes will take on reasonable defaults or, where applicable, defaults as specified in the SIP standard.

URIs are treated as immutable, though new URIs can be created from existing ones easily.

from ursine import URI

uri1 = URI('sip:localhost:5080;transport=tcp')
uri2 = URI('sips:localhost:5080')

assert uri1 != uri2
assert uri1 == uri2.with_scheme('sip')
# since URIs are immutable, uri2 is unchanged
assert uri1 != uri2
class ursine.uri.URI(uri: str)

A SIP URI

classmethod build(*, scheme: str, user: Union[str, NoneType] = None, password: Union[str, NoneType] = None, userinfo: Union[str, NoneType] = None, host: Union[str, NoneType] = None, port: Union[int, NoneType] = None, hostport: Union[str, NoneType] = None, parameters: Union[dict, NoneType] = None, headers: Union[multidict._multidict.MultiDict, NoneType] = None, transport: Union[str, NoneType] = None) → ursine.uri.URI

Build a URI from individual pieces.

Both the userinfo and hostport may be broken down into user/password and host/port respectively for convenience, and similarly the transport parameter is offered as an argument for convenience.

short_str()

Get a string representation without parameters/headers.

with_headers(headers: multidict._multidict.MultiDict)

Create a new URI from self with specific headers.

with_host(host: str)

Create a new URI from self with a specific host.

with_hostport(hostport: str)

Create a new URI from self with a specific hostport.

with_parameters(parameters: Dict[str, str])

Create a new URI from self with specific parameters.

with_password(password: Union[str, NoneType])

Create a new URI from self with a specific password.

with_port(port: int)

Create a new URI from self with a specific port.

with_scheme(scheme: str)

Create a new URI from self with a specific scheme.

with_transport(transport: str)

Create a new URI from self with a specific transport.

with_user(user: Union[str, NoneType])

Create a new URI from self with a specific user.

with_userinfo(userinfo: str)

Create a new URI from self with a specific userinfo.

exception ursine.uri.URIError