Package proton :: Module _url :: Class Url
[frames] | no frames]

type Url

source code


Simple URL parser/constructor, handles URLs of the form:

<scheme>://<user>:<password>@<host>:<port>/<path>

All components can be None if not specified in the URL string.

The port can be specified as a service name, e.g. 'amqp' in the URL string but Url.port always gives the integer value.

Warning: The placement of user and password in URLs is not recommended. It can result in credentials leaking out in program logs. Use connection configuration attributes instead.

Nested Classes
Port
An integer port number that can be constructed from a service name string
Instance Methods
 
__init__(self, url=None, defaults=True, **kwargs) source code
 
__str__(self) source code
 
__repr__(self) source code
 
__eq__(self, x) source code
 
__ne__(self, x) source code
 
defaults(self)
Fill in missing values (scheme, host or port) with defaults
source code
Class Variables
  AMQPS = 'amqps'
  AMQP = 'amqp'
Instance Variables
  host
Host name, ipv6 literal or ipv4 dotted quad.
  port
Integer port.
  host_port
Returns host:port
  password
Password
  scheme
Url scheme e.g.
  user
Username
Properties
  path
Method Details

__init__(self, url=None, defaults=True, **kwargs)
(Constructor)

source code 
Parameters:
  • url - URL string to parse.
  • defaults - If true, fill in missing default values in the URL. If false, you can fill them in later by calling self.defaults()
  • kwargs - scheme, user, password, host, port, path. If specified, replaces corresponding part in url string.
Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 
Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
Overrides: object.__repr__
(inherited documentation)

defaults(self)

source code 

Fill in missing values (scheme, host or port) with defaults

Returns:
self

Instance Variable Details

host

Host name, ipv6 literal or ipv4 dotted quad.

port

Integer port.

scheme

Url scheme e.g. 'amqp' or 'amqps'

Property Details

path