Adds support for amqps:// to use pyamqp with ssl=True. Closes #610

This commit is contained in:
Ask Solem 2016-09-07 17:21:22 -07:00
parent c636c1e806
commit 701672c2ba
3 changed files with 18 additions and 0 deletions

View File

@ -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',

View File

@ -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

View File

@ -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):