Skip to content

Commit

Permalink
Make Haigha optional
Browse files Browse the repository at this point in the history
Since not Py3 compatible

References #4
  • Loading branch information
jonnor committed Nov 13, 2017
1 parent b68b1d9 commit ecafdd2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions msgflo/msgflo.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@
import gevent.event

# AMQP
from haigha.connection import Connection as haigha_Connection
from haigha.message import Message as haigha_Message
haigha = None
try:
import haigha
from haigha.connection import Connection as haigha_Connection
from haigha.message import Message as haigha_Message
except ImportError as e:
haigha = e

# MQTT
import paho.mqtt.client as mqtt
Expand Down Expand Up @@ -111,6 +116,9 @@ class AmqpEngine(Engine):
def __init__(self, broker, discovery_period=None):
Engine.__init__(self, broker, discovery_period=discovery_period)

if isinstance(haigha, Exception):
raise haigha

# Prepare connection to AMQP broker
vhost = '/'
if self.broker_info.path:
Expand Down

0 comments on commit ecafdd2

Please sign in to comment.