diff options
author | 2019-03-19 18:48:33 -0600 | |
---|---|---|
committer | 2019-03-19 18:48:33 -0600 | |
commit | 42f9140c413aba70b62c085f1d1f6b5356a684a0 (patch) | |
tree | 0221f692f7db4da6b66c8f96682e5eff01c77c71 /rmq.py | |
parent | Add flake8-docstrings to Pipenv (diff) |
Add docstrings
Diffstat (limited to 'rmq.py')
-rw-r--r-- | rmq.py | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -16,7 +16,8 @@ from config import EXCHANGE from logs import log -class Rmq(object): +class Rmq: + """Rabbit MQ (RMQ) implementation used for communication with the bot.""" def __init__(self, username=USERNAME, @@ -42,6 +43,7 @@ class Rmq(object): auto_delete=True) # Delete queue when all connection are closed def consume(self, queue=QUEUE, callback=None, thread_ws=None, run_once=False): + """Subscribe to read from a RMQ channel.""" while True: try: connection = pika.BlockingConnection(self.con_params) @@ -86,11 +88,8 @@ class Rmq(object): time.sleep(2) - def publish(self, - message, - queue=QUEUE, - routingkey=ROUTING_KEY, - exchange=EXCHANGE): + def publish(self, message, queue=QUEUE, routingkey=ROUTING_KEY, exchange=EXCHANGE): + """Open a connection to publish (write) to a RMQ channel.""" try: connection = pika.BlockingConnection(self.con_params) |