From d570f08750cce6a5aef885ed4f2943294c8465a8 Mon Sep 17 00:00:00 2001 From: mp-loki Date: Fri, 18 Aug 2017 07:22:56 -0400 Subject: [PATCH] python clients fixed 'TypeError: on_connect() takes exactly 3 arguments (4 given)' --- tools/src/main/python/one-way-ssl-mqtt-client.py | 2 +- tools/src/main/python/simple-mqtt-client.py | 3 ++- tools/src/main/python/two-way-ssl-mqtt-client.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/src/main/python/one-way-ssl-mqtt-client.py b/tools/src/main/python/one-way-ssl-mqtt-client.py index 9266fbfc0b..f4e7e1d3d6 100644 --- a/tools/src/main/python/one-way-ssl-mqtt-client.py +++ b/tools/src/main/python/one-way-ssl-mqtt-client.py @@ -19,7 +19,7 @@ import paho.mqtt.client as mqtt import ssl, socket # The callback for when the client receives a CONNACK response from the server. -def on_connect(client, userdata, rc): +def on_connect(client, userdata, rc, *extra_params): print('Connected with result code '+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. diff --git a/tools/src/main/python/simple-mqtt-client.py b/tools/src/main/python/simple-mqtt-client.py index 5f511f4a4c..8b21df6cfc 100644 --- a/tools/src/main/python/simple-mqtt-client.py +++ b/tools/src/main/python/simple-mqtt-client.py @@ -18,8 +18,9 @@ import paho.mqtt.client as mqtt # The callback for when the client receives a CONNACK response from the server. -def on_connect(client, userdata, rc): +def on_connect(client, userdata, rc, *extra_params): print('Connected with result code '+str(rc)) + #print('***' + str(r)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed. client.subscribe('v1/devices/me/attributes') diff --git a/tools/src/main/python/two-way-ssl-mqtt-client.py b/tools/src/main/python/two-way-ssl-mqtt-client.py index d3b32423e1..169c0e592a 100644 --- a/tools/src/main/python/two-way-ssl-mqtt-client.py +++ b/tools/src/main/python/two-way-ssl-mqtt-client.py @@ -19,7 +19,7 @@ import paho.mqtt.client as mqtt import ssl, socket # The callback for when the client receives a CONNACK response from the server. -def on_connect(client, userdata, rc): +def on_connect(client, userdata, rc, *extra_params): print('Connected with result code '+str(rc)) # Subscribing in on_connect() means that if we lose the connection and # reconnect then subscriptions will be renewed.