diff --git a/kombu/transport/__init__.py b/kombu/transport/__init__.py index 9455275e..5d247798 100644 --- a/kombu/transport/__init__.py +++ b/kombu/transport/__init__.py @@ -18,6 +18,7 @@ def supports_librabbitmq(): TRANSPORT_ALIASES = { 'amqp': 'kombu.transport.pyamqp:Transport', + 'amqps': 'kombu.transport.pyamqp:SSLTransport', 'pyamqp': 'kombu.transport.pyamqp:Transport', 'librabbitmq': 'kombu.transport.librabbitmq:Transport', 'memory': 'kombu.transport.memory:Transport', diff --git a/kombu/transport/pyamqp.py b/kombu/transport/pyamqp.py index f62a1e74..9790eee4 100644 --- a/kombu/transport/pyamqp.py +++ b/kombu/transport/pyamqp.py @@ -156,3 +156,14 @@ class Transport(base.Transport): def get_manager(self, *args, **kwargs): return get_manager(self.client, *args, **kwargs) + + +class SSLTransport(Transport): + + def __init__(self, *args, **kwargs): + super(SSLTransport, self).__init__(*args, **kwargs) + + # ugh, not exactly pure, but hey, it's python. + self.client.ssl = True + + diff --git a/t/unit/transport/test_pyamqp.py b/t/unit/transport/test_pyamqp.py index 1c8812b8..82929916 100644 --- a/t/unit/transport/test_pyamqp.py +++ b/t/unit/transport/test_pyamqp.py @@ -11,6 +11,12 @@ from kombu.five import nextfun from kombu.transport import pyamqp +def test_amqps_connection(): + conn = Connection('amqps://') + assert conn.transport # evaluate transport, don't connect + assert conn.ssl + + class MockConnection(dict): def __setattr__(self, key, value):