Ejemplo n.º 1
0
    def __init__(self,
                 uri,
                 ssl_options=None,
                 client_properties=None,
                 lazy=False):
        """
        :param str uri: AMQP Connection string

        :raises TypeError: Raises on invalid uri.
        :raises ValueError: Raises on invalid uri.
        :raises AttributeError: Raises on invalid uri.
        :raises AMQPConnectionError: Raises if the connection
                                     encountered an error.
        """
        uri = compatibility.patch_uri(uri)
        parsed_uri = urlparse.urlparse(uri)
        use_ssl = parsed_uri.scheme == 'https'
        hostname = parsed_uri.hostname or 'localhost'
        port = parsed_uri.port or 5672
        username = urlparse.unquote(parsed_uri.username or 'guest')
        password = urlparse.unquote(parsed_uri.password or 'guest')
        kwargs = self._parse_uri_options(parsed_uri, use_ssl, ssl_options)
        super(UriConnection,
              self).__init__(hostname,
                             username,
                             password,
                             port,
                             client_properties=client_properties,
                             lazy=lazy,
                             **kwargs)
Ejemplo n.º 2
0
 def __init__(self, uri, lazy=False):
     """
     :param str uri: AMQP Connection string
     """
     uri = compatibility.patch_uri(uri)
     parsed_uri = urlparse.urlparse(uri)
     use_ssl = parsed_uri.scheme == 'https'
     hostname = parsed_uri.hostname or 'localhost'
     port = parsed_uri.port or 5672
     username = parsed_uri.username or 'guest'
     password = parsed_uri.password or 'guest'
     kwargs = self._parse_uri_options(parsed_uri, use_ssl, lazy)
     super(UriConnection, self).__init__(hostname, username, password, port,
                                         **kwargs)
Ejemplo n.º 3
0
 def __init__(self, uri, lazy=False):
     """
     :param str uri: AMQP Connection string
     """
     uri = compatibility.patch_uri(uri)
     parsed_uri = urlparse.urlparse(uri)
     use_ssl = parsed_uri.scheme == 'https'
     hostname = parsed_uri.hostname or 'localhost'
     port = parsed_uri.port or 5672
     username = parsed_uri.username or 'guest'
     password = parsed_uri.password or 'guest'
     kwargs = self._parse_uri_options(parsed_uri, use_ssl, lazy)
     super(UriConnection, self).__init__(hostname, username,
                                         password, port,
                                         **kwargs)
Ejemplo n.º 4
0
    def __init__(self, uri, ssl_options=None, lazy=False):
        """
        :param str uri: AMQP Connection string

        :raises TypeError: Raises on invalid uri.
        :raises ValueError: Raises on invalid uri.
        :raises AttributeError: Raises on invalid uri.
        :raises AMQPConnectionError: Raises if the connection
                                     encountered an error.
        """
        uri = compatibility.patch_uri(uri)
        parsed_uri = urlparse.urlparse(uri)
        use_ssl = parsed_uri.scheme == 'https'
        hostname = parsed_uri.hostname or 'localhost'
        port = parsed_uri.port or 5672
        username = urlparse.unquote(parsed_uri.username or 'guest')
        password = urlparse.unquote(parsed_uri.password or 'guest')
        kwargs = self._parse_uri_options(parsed_uri, use_ssl, ssl_options)
        super(UriConnection, self).__init__(hostname, username,
                                            password, port,
                                            lazy=lazy,
                                            **kwargs)
Ejemplo n.º 5
0
 def test_compatibility_patch_uri(self):
     self.assertEqual(compatibility.patch_uri('amqps://'), 'https://')
     self.assertEqual(compatibility.patch_uri('amqp://'), 'http://')