summaryrefslogtreecommitdiff
path: root/kombu/utils/amq_manager.py
blob: 0bb9ce4c11c9c38150deec930c4e8d9e3d62c1b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from __future__ import absolute_import


def get_manager(client, hostname=None, port=None, userid=None,
            password=None):
    import pyrabbit
    opt = client.transport_options.get
    host = (hostname if hostname is not None
                        else opt('manager_hostname', client.hostname))
    port = port if port is not None else opt('manager_port', 55672)
    return pyrabbit.Client('%s:%s' % (host, port),
        userid if userid is not None
                else opt('manager_userid', client.userid),
        password if password is not None
                else opt('manager_password', client.password))