aboutsummaryrefslogtreecommitdiffstats
path: root/rmq.py
diff options
context:
space:
mode:
authorGravatar Christopher Goes <[email protected]>2019-03-19 18:48:33 -0600
committerGravatar Christopher Goes <[email protected]>2019-03-19 18:48:33 -0600
commit42f9140c413aba70b62c085f1d1f6b5356a684a0 (patch)
tree0221f692f7db4da6b66c8f96682e5eff01c77c71 /rmq.py
parentAdd flake8-docstrings to Pipenv (diff)
Add docstrings
Diffstat (limited to 'rmq.py')
-rw-r--r--rmq.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/rmq.py b/rmq.py
index 493a38f..a0dade7 100644
--- a/rmq.py
+++ b/rmq.py
@@ -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)