Skip to content

Commit ecafdd2

Browse files
committed
Make Haigha optional
Since not Py3 compatible References #4
1 parent b68b1d9 commit ecafdd2

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

msgflo/msgflo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
import gevent.event
2323

2424
# AMQP
25-
from haigha.connection import Connection as haigha_Connection
26-
from haigha.message import Message as haigha_Message
25+
haigha = None
26+
try:
27+
import haigha
28+
from haigha.connection import Connection as haigha_Connection
29+
from haigha.message import Message as haigha_Message
30+
except ImportError as e:
31+
haigha = e
2732

2833
# MQTT
2934
import paho.mqtt.client as mqtt
@@ -111,6 +116,9 @@ class AmqpEngine(Engine):
111116
def __init__(self, broker, discovery_period=None):
112117
Engine.__init__(self, broker, discovery_period=discovery_period)
113118

119+
if isinstance(haigha, Exception):
120+
raise haigha
121+
114122
# Prepare connection to AMQP broker
115123
vhost = '/'
116124
if self.broker_info.path:

0 commit comments

Comments
 (0)