Skip to content

Commit ed6d744

Browse files
author
David Parker
committed
Updates to support paho-mqtt 1.0
Fix for change in on_connect() callback parameters between paho-mqtt 0.9 and 1.0
1 parent d97ab58 commit ed6d744

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
description='IBM Internet of Things Cloud for Python',
2020
long_description=open('README.txt').read(),
2121
install_requires=[
22-
"paho-mqtt >= 0.9",
23-
"iso8601 == 0.1.10",
22+
"paho-mqtt >= 1.0",
23+
"iso8601 >= 0.1.10",
2424
]
2525
)

src/ibmiotc/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import iso8601
2222
from datetime import datetime
2323

24-
__version__ = "0.0.5"
24+
__version__ = "0.0.6"
2525

2626
class Message:
2727
def __init__(self, message):
@@ -105,9 +105,9 @@ def __logAndRaiseException(self, e):
105105
def connect(self):
106106
self.logger.debug("Connecting... (address = %s, port = %s, clientId = %s, username = %s, password = %s)" % (self.address, self.port, self.clientId, self.username, self.password))
107107
try:
108-
self.client.loop_start()
109108
self.connectEvent.clear()
110109
self.client.connect(self.address, port=self.port, keepalive=self.keepAlive)
110+
self.client.loop_start()
111111
if not self.connectEvent.wait(timeout=10):
112112
self.__logAndRaiseException(ConnectionException("Operation timed out connecting to the IBM Internet of Things service: %s" % (self.address)))
113113

@@ -143,12 +143,12 @@ def on_log(self, mqttc, obj, level, string):
143143
4: Refused - bad user name or password (MQTT v3.1 broker only)
144144
5: Refused - not authorised (MQTT v3.1 broker only)
145145
'''
146-
def on_connect(self, mosq, obj, rc):
146+
def on_connect(self, client, userdata, flags, rc):
147147
if rc == 0:
148148
self.connectEvent.set()
149149
self.logger.info("Connected successfully")
150150
elif rc == 5:
151-
self.__logAndRaiseException(ConnectionException("Not authorized: s (%s, %s)" % (self.clientId, self.username, self.password)))
151+
self.__logAndRaiseException(ConnectionException("Not authorized: s (%s, %s, %s)" % (self.clientId, self.username, self.password)))
152152
else:
153153
self.__logAndRaiseException(ConnectionException("Connection failed: RC= %s" % (rc)))
154154

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy