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

Class 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
PartDescriptor
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
 
__del__(self) source code
 
defaults(self)
Fill in missing values (scheme, host or port) with defaults
source code
Class Variables
  AMQPS = "amqps"
  AMQP = "amqp"
  username = PartDescriptor('username')
  path = PartDescriptor('path')
Instance Variables
  scheme = PartDescriptor('scheme')
Url scheme e.g.
  password = PartDescriptor('password')
Password
  host = PartDescriptor('host')
Host name, ipv6 literal or ipv4 dotted quad.
  port = property(_get_port, _set_port)
Integer port.
  host_port
Returns host:port
  user
Username
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

scheme

Url scheme e.g. 'amqp' or 'amqps'
Value:
PartDescriptor('scheme')