queue: Refactor Pika credentials code to be a bit cleaner.

This commit is contained in:
Tim Abbott 2016-05-07 15:50:15 -07:00
parent 6c744564a7
commit 0c42fc2f8f
1 changed files with 3 additions and 2 deletions

View File

@ -38,9 +38,10 @@ class SimpleQueueClient(object):
self._connect()
def _get_parameters(self):
credentials = pika.PlainCredentials(settings.RABBITMQ_USERNAME,
settings.RABBITMQ_PASSWORD)
return pika.ConnectionParameters(settings.RABBITMQ_HOST,
credentials = pika.PlainCredentials(
settings.RABBITMQ_USERNAME, settings.RABBITMQ_PASSWORD))
credentials=credentials)
def _generate_ctag(self, queue_name):
return "%s_%s" % (queue_name, str(random.getrandbits(16)))