Hello community,
here is the log from the commit of package python-paho-mqtt for
openSUSE:Factory checked in at 2020-09-25 16:34:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-paho-mqtt (Old)
and /work/SRC/openSUSE:Factory/.python-paho-mqtt.new.4249 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-paho-mqtt"
Fri Sep 25 16:34:30 2020 rev:5 rq:836463 version:1.5.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-paho-mqtt/python-paho-mqtt.changes
2019-10-31 22:29:24.772652651 +0100
+++
/work/SRC/openSUSE:Factory/.python-paho-mqtt.new.4249/python-paho-mqtt.changes
2020-09-25 16:35:38.604109196 +0200
@@ -1,0 +2,10 @@
+Wed Sep 23 21:23:55 UTC 2020 - Martin Hauke <[email protected]>
+
+- Update to version 1.5.1:
+ * Exceptions that occur in callbacks are no longer suppressed
+ by default. They can optionally be suppressed by setting
+ `client.suppress_exceptions = True`.
+ * Fix PUBREL remaining length of > 2 not being accepted for
+ MQTT v5 message flows.
+
+-------------------------------------------------------------------
Old:
----
paho-mqtt-1.5.0.tar.gz
New:
----
paho-mqtt-1.5.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-paho-mqtt.spec ++++++
--- /var/tmp/diff_new_pack.Dm2jK1/_old 2020-09-25 16:35:39.164109694 +0200
+++ /var/tmp/diff_new_pack.Dm2jK1/_new 2020-09-25 16:35:39.168109698 +0200
@@ -1,7 +1,7 @@
#
# spec file for package python-paho-mqtt
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,12 +18,12 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-paho-mqtt
-Version: 1.5.0
+Version: 1.5.1
Release: 0
Summary: MQTT version 3.11 client class
License: EPL-1.0
Group: Development/Languages/Python
-Url: http://eclipse.org/paho
+URL: http://eclipse.org/paho
Source:
https://files.pythonhosted.org/packages/source/p/paho-mqtt/paho-mqtt-%{version}.tar.gz
BuildRequires: %{python_module pytest-runner}
BuildRequires: %{python_module setuptools}
++++++ paho-mqtt-1.5.0.tar.gz -> paho-mqtt-1.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/PKG-INFO new/paho-mqtt-1.5.1/PKG-INFO
--- old/paho-mqtt-1.5.0/PKG-INFO 2019-10-30 22:28:12.000000000 +0100
+++ new/paho-mqtt-1.5.1/PKG-INFO 2020-09-22 20:48:37.287400200 +0200
@@ -1,7 +1,7 @@
Metadata-Version: 2.1
Name: paho-mqtt
-Version: 1.5.0
-Summary: MQTT version 3.1.1 client class
+Version: 1.5.1
+Summary: MQTT version 5.0/3.1.1 client class
Home-page: http://eclipse.org/paho
Author: Roger Light
Author-email: [email protected]
@@ -9,11 +9,11 @@
Description: Eclipse Paho™ MQTT Python Client
================================
- This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 3.1 and 3.1.1 of the MQTT protocol.
+ This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 5.0, 3.1.1, and 3.1 of the MQTT protocol.
This code provides a client class which enable applications to connect
to an `MQTT <http://mqtt.org/>`_ broker to publish messages, and to subscribe
to topics and receive published messages. It also provides some helper
functions to make publishing one off messages to an MQTT server very
straightforward.
- It supports Python 2.7.9+ or 3.4+, with limited support for Python 2.7
before 2.7.9.
+ It supports Python 2.7.9+ or 3.5+.
The MQTT protocol is a machine-to-machine (M2M)/"Internet of Things"
connectivity protocol. Designed as an extremely lightweight publish/subscribe
messaging transport, it is useful for connections with remote locations where a
small code footprint is required and/or network bandwidth is at a premium.
@@ -1485,9 +1485,10 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Communications
Classifier: Topic :: Internet
Provides-Extra: proxy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/README.rst
new/paho-mqtt-1.5.1/README.rst
--- old/paho-mqtt-1.5.0/README.rst 2019-10-30 21:55:05.000000000 +0100
+++ new/paho-mqtt-1.5.1/README.rst 2020-09-22 20:44:30.000000000 +0200
@@ -1,11 +1,11 @@
Eclipse Paho™ MQTT Python Client
================================
-This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 3.1 and 3.1.1 of the MQTT protocol.
+This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 5.0, 3.1.1, and 3.1 of the MQTT protocol.
This code provides a client class which enable applications to connect to an
`MQTT <http://mqtt.org/>`_ broker to publish messages, and to subscribe to
topics and receive published messages. It also provides some helper functions
to make publishing one off messages to an MQTT server very straightforward.
-It supports Python 2.7.9+ or 3.4+, with limited support for Python 2.7 before
2.7.9.
+It supports Python 2.7.9+ or 3.5+.
The MQTT protocol is a machine-to-machine (M2M)/"Internet of Things"
connectivity protocol. Designed as an extremely lightweight publish/subscribe
messaging transport, it is useful for connections with remote locations where a
small code footprint is required and/or network bandwidth is at a premium.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/examples/aws_iot.py
new/paho-mqtt-1.5.1/examples/aws_iot.py
--- old/paho-mqtt-1.5.0/examples/aws_iot.py 2019-10-30 21:55:05.000000000
+0100
+++ new/paho-mqtt-1.5.1/examples/aws_iot.py 2020-09-22 20:16:17.000000000
+0200
@@ -1,9 +1,10 @@
-import hmac
-import hashlib
-import datetime
import base64
-import uuid
+import datetime
import functools
+import hashlib
+import hmac
+import os
+import uuid
from paho.mqtt.client import Client
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/examples/client_mqtt_clear_retain.py
new/paho-mqtt-1.5.1/examples/client_mqtt_clear_retain.py
--- old/paho-mqtt-1.5.0/examples/client_mqtt_clear_retain.py 2019-10-30
21:55:05.000000000 +0100
+++ new/paho-mqtt-1.5.1/examples/client_mqtt_clear_retain.py 2020-09-22
20:16:17.000000000 +0200
@@ -71,7 +71,7 @@
try:
opts, args = getopt.getopt(argv, "dh:i:k:p:P:t:u:v",
["debug", "id", "keepalive", "port",
"password", "topic", "username", "verbose"])
- except getopt.GetoptError as s:
+ except getopt.GetoptError:
print_usage()
sys.exit(2)
for opt, arg in opts:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/examples/client_rpc_math.py
new/paho-mqtt-1.5.1/examples/client_rpc_math.py
--- old/paho-mqtt-1.5.0/examples/client_rpc_math.py 1970-01-01
01:00:00.000000000 +0100
+++ new/paho-mqtt-1.5.1/examples/client_rpc_math.py 2020-09-22
20:16:17.000000000 +0200
@@ -0,0 +1,110 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2020 Frank Pagliughi <[email protected]>
+# All rights reserved.
+#
+# This program and the accompanying materials are made available
+# under the terms of the Eclipse Distribution License v1.0
+# which accompanies this distribution.
+#
+# The Eclipse Distribution License is available at
+# http://www.eclipse.org/org/documents/edl-v10.php.
+#
+# Contributors:
+# Frank Pagliughi - initial implementation
+#
+
+# This shows an example of an MQTTv5 Remote Procedure Call (RPC) client.
+
+import context # Ensures paho is in PYTHONPATH
+import sys
+import time
+import json
+import paho.mqtt.client as mqtt
+from paho.mqtt.packettypes import PacketTypes
+
+# These will be updated with the server-assigned Client ID
+client_id = "mathcli"
+reply_to = ""
+
+# This correlates the outbound request with the returned reply
+corr_id = b"1"
+
+# This is sent in the message callback when we get the respone
+reply = None
+
+# The MQTTv5 callback takes the additional 'props' parameter.
+def on_connect(mqttc, userdata, flags, rc, props):
+ global client_id, reply_to
+
+ print("Connected: '"+str(flags)+"', '"+str(rc)+"', '"+str(props))
+ if hasattr(props, 'AssignedClientIdentifier'):
+ client_id = props.AssignedClientIdentifier
+ reply_to = "replies/math/" + client_id
+ mqttc.subscribe(reply_to)
+
+
+# An incoming message should be the reply to our request
+def on_message(mqttc, userdata, msg):
+ global reply
+
+ print(msg.topic+" "+str(msg.payload)+" "+str(msg.properties))
+ props = msg.properties
+ if not hasattr(props, 'CorrelationData'):
+ print("No correlation ID")
+
+ # Match the response to the request correlation ID.
+ if props.CorrelationData == corr_id:
+ reply = msg.payload
+
+
+if len(sys.argv) < 3:
+ print("USAGE: client_rpc_math.py [add|mult] n1 n2 ...")
+ sys.exit(1)
+
+mqttc = mqtt.Client(client_id="", protocol=mqtt.MQTTv5)
+mqttc.on_message = on_message
+mqttc.on_connect = on_connect
+
+mqttc.connect(host='localhost', clean_start=True)
+mqttc.loop_start()
+
+# Wait for connection to set `client_id`, etc.
+while not mqttc.is_connected():
+ time.sleep(0.1)
+
+# Properties for the request specify the ResponseTopic and CorrelationData
+props = mqtt.Properties(PacketTypes.PUBLISH)
+props.CorrelationData = corr_id
+props.ResponseTopic = reply_to
+
+# Uncomment to see what got set
+#print("Client ID: "+client_id)
+#print("Reply To: "+reply_to)
+#print(props)
+
+# The requested operation, 'add' or 'mult'
+func = sys.argv[1]
+
+# Gather the numeric parameters as an array of numbers
+# These can be int's or float's
+args = []
+for s in sys.argv[2:]:
+ args.append(float(s))
+
+# Send the request
+topic = "requests/math/" + func
+payload = json.dumps(args)
+mqttc.publish(topic, payload, qos=1, properties=props)
+
+# Wait for the reply
+while reply is None:
+ time.sleep(0.1)
+
+# Extract the response and print it.
+rsp = json.loads(reply)
+print("Response: "+str(rsp))
+
+mqttc.loop_stop()
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/examples/server_rpc_math.py
new/paho-mqtt-1.5.1/examples/server_rpc_math.py
--- old/paho-mqtt-1.5.0/examples/server_rpc_math.py 1970-01-01
01:00:00.000000000 +0100
+++ new/paho-mqtt-1.5.1/examples/server_rpc_math.py 2020-09-22
20:16:17.000000000 +0200
@@ -0,0 +1,95 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2020 Frank Pagliughi <[email protected]>
+# All rights reserved.
+#
+# This program and the accompanying materials are made available
+# under the terms of the Eclipse Distribution License v1.0
+# which accompanies this distribution.
+#
+# The Eclipse Distribution License is available at
+# http://www.eclipse.org/org/documents/edl-v10.php.
+#
+# Contributors:
+# Frank Pagliughi - initial implementation
+#
+
+# This shows an example of an MQTTv5 Remote Procedure Call (RPC) server.
+
+import context # Ensures paho is in PYTHONPATH
+import json
+import paho.mqtt.client as mqtt
+from paho.mqtt.packettypes import PacketTypes
+
+# The math functions exported
+
+def add(nums):
+ sum = 0
+ for x in nums:
+ sum += x
+ return sum
+
+def mult(nums):
+ prod = 1
+ for x in nums:
+ prod *= x
+ return prod
+
+# Remember that the MQTTv5 callback takes the additional 'props' parameter.
+def on_connect(mqttc, userdata, flags, rc, props):
+ print("Connected: '"+str(flags)+"', '"+str(rc)+"', '"+str(props))
+ if not flags["session present"]:
+ print("Subscribing to math requests")
+ mqttc.subscribe("requests/math/#")
+
+# Each incoming message should be an RPC request on the
+# 'requests/math/#' topic.
+def on_message(mqttc, userdata, msg):
+ print(msg.topic + " " + str(msg.payload))
+
+ # Get the response properties, abort if they're not given
+ props = msg.properties
+ if not hasattr(props, 'ResponseTopic') or not hasattr(props,
'CorrelationData'):
+ print("No reply requested")
+ return
+
+ corr_id = props.CorrelationData
+ reply_to = props.ResponseTopic
+
+ # The command parameters are in the payload
+ nums = json.loads(msg.payload)
+
+ # The requested command is at the end of the topic
+ res = 0
+ if msg.topic.endswith("add"):
+ res = add(nums)
+ elif msg.topic.endswith("mult"):
+ res = mult(nums)
+
+ # Now we have the result, res, so send it back on the 'reply_to'
+ # topic using the same correlation ID as the request.
+ print("Sending response "+str(res)+" on '"+reply_to+"': "+str(corr_id))
+ props = mqtt.Properties(PacketTypes.PUBLISH)
+ props.CorrelationData = corr_id
+
+ payload = json.dumps(res)
+ mqttc.publish(reply_to, payload, qos=1, properties=props)
+
+def on_log(mqttc, obj, level, string):
+ print(string)
+
+
+# Typically with an RPC service, you want to make sure that you're the only
+# client answering requests for specific topics. Using a known client ID
+# might help.
+mqttc = mqtt.Client(client_id="paho_rpc_math_srvr", protocol=mqtt.MQTTv5)
+mqttc.on_message = on_message
+mqttc.on_connect = on_connect
+
+# Uncomment to enable debug messages
+#mqttc.on_log = on_log
+
+#mqttc.connect("mqtt.eclipse.org", 1883, 60)
+mqttc.connect(host="localhost", clean_start=False)
+mqttc.loop_forever()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/setup.py new/paho-mqtt-1.5.1/setup.py
--- old/paho-mqtt-1.5.0/setup.py 2019-10-30 21:55:05.000000000 +0100
+++ new/paho-mqtt-1.5.1/setup.py 2020-09-22 20:44:30.000000000 +0200
@@ -22,7 +22,7 @@
setup(
name='paho-mqtt',
version=__version__,
- description='MQTT version 3.1.1 client class',
+ description='MQTT version 5.0/3.1.1 client class',
long_description=readme,
author='Roger Light',
author_email='[email protected]',
@@ -46,9 +46,10 @@
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
+ 'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
'Topic :: Communications',
'Topic :: Internet',
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/src/paho/mqtt/__init__.py
new/paho-mqtt-1.5.1/src/paho/mqtt/__init__.py
--- old/paho-mqtt-1.5.0/src/paho/mqtt/__init__.py 2019-10-30
21:55:05.000000000 +0100
+++ new/paho-mqtt-1.5.1/src/paho/mqtt/__init__.py 2020-09-22
20:44:30.000000000 +0200
@@ -1,4 +1,4 @@
-__version__ = "1.5.0"
+__version__ = "1.5.1"
class MQTTException(Exception):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/src/paho/mqtt/client.py
new/paho-mqtt-1.5.1/src/paho/mqtt/client.py
--- old/paho-mqtt-1.5.0/src/paho/mqtt/client.py 2019-10-30 21:55:05.000000000
+0100
+++ new/paho-mqtt-1.5.1/src/paho/mqtt/client.py 2020-09-22 20:16:17.000000000
+0200
@@ -436,6 +436,9 @@
"userdata" is user data of any type and can be set when creating a new
client
instance or with user_data_set(userdata).
+ If you wish to suppress exceptions within a callback, you should set
+ `client.suppress_exceptions = True`
+
The callbacks:
on_connect(client, userdata, flags, rc, properties=None): called when the
broker responds to our connection
@@ -651,6 +654,7 @@
self._websocket_extra_headers = None
# for clean_start == MQTT_CLEAN_START_FIRST_ONLY
self._mqttv5_first_connect = True
+ self.suppress_exceptions = False # For callbacks
def __del__(self):
self._reset_sockets()
@@ -925,7 +929,7 @@
"""
if self._protocol == MQTTv5:
- self._mqttv5_first_connect == True
+ self._mqttv5_first_connect = True
else:
if clean_start != MQTT_CLEAN_START_FIRST_ONLY:
raise ValueError("Clean start only applies to MQTT V5")
@@ -1637,14 +1641,7 @@
else:
rc = 1
- with self._callback_mutex:
- if self.on_disconnect:
- with self._in_callback_mutex:
- try:
- self.on_disconnect(self, self._userdata, rc)
- except Exception as err:
- self._easy_log(
- MQTT_LOG_ERR, 'Caught exception in
on_disconnect: %s', err)
+ self._do_on_disconnect(rc)
return MQTT_ERR_CONN_LOST
@@ -2075,6 +2072,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_socket_open:
%s', err)
+ if not self.suppress_exceptions:
+ raise
@property
def on_socket_close(self):
@@ -2107,6 +2106,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in
on_socket_close: %s', err)
+ if not self.suppress_exceptions:
+ raise
@property
def on_socket_register_write(self):
@@ -2142,6 +2143,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in
on_socket_register_write: %s', err)
+ if not self.suppress_exceptions:
+ raise
@property
def on_socket_unregister_write(self):
@@ -2178,6 +2181,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in
on_socket_unregister_write: %s', err)
+ if not self.suppress_exceptions:
+ raise
def message_callback_add(self, sub, callback):
"""Register a message callback for a specific topic.
@@ -2219,18 +2224,8 @@
if self._state == mqtt_cs_disconnecting:
rc = MQTT_ERR_SUCCESS
- with self._callback_mutex:
- if self.on_disconnect:
- with self._in_callback_mutex:
- try:
- if properties:
- self.on_disconnect(
- self, self._userdata, rc, properties)
- else:
- self.on_disconnect(self, self._userdata, rc)
- except Exception as err:
- self._easy_log(
- MQTT_LOG_ERR, 'Caught exception in
on_disconnect: %s', err)
+ self._do_on_disconnect(rc, properties)
+
return rc
def _packet_read(self):
@@ -2365,6 +2360,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in
on_publish: %s', err)
+ if not self.suppress_exceptions:
+ raise
packet['info']._set_as_published()
@@ -2374,15 +2371,7 @@
with self._msgtime_mutex:
self._last_msg_out = time_func()
- with self._callback_mutex:
- if self.on_disconnect:
- with self._in_callback_mutex:
- try:
- self.on_disconnect(
- self, self._userdata, 0)
- except Exception as err:
- self._easy_log(
- MQTT_LOG_ERR, 'Caught exception in
on_disconnect: %s', err)
+ self._do_on_disconnect(0)
self._sock_close()
return MQTT_ERR_SUCCESS
@@ -2437,14 +2426,8 @@
rc = MQTT_ERR_SUCCESS
else:
rc = 1
- with self._callback_mutex:
- if self.on_disconnect:
- with self._in_callback_mutex:
- try:
- self.on_disconnect(self, self._userdata, rc)
- except Exception as err:
- self._easy_log(
- MQTT_LOG_ERR, 'Caught exception in
on_disconnect: %s', err)
+
+ self._do_on_disconnect(rc)
def _mid_generate(self):
with self._mid_generate_mutex:
@@ -2614,7 +2597,7 @@
if self._protocol == MQTTv5:
if self._clean_start == True:
connect_flags |= 0x02
- elif self._clean_start == MQTT_CLEAN_START_FIRST_ONLY and
self._mqttv5_first_connect == True:
+ elif self._clean_start == MQTT_CLEAN_START_FIRST_ONLY and
self._mqttv5_first_connect:
connect_flags |= 0x02
elif self._clean_session:
connect_flags |= 0x02
@@ -2834,7 +2817,8 @@
m.payload,
m.qos,
m.retain,
- m.dup
+ m.dup,
+ properties=m.properties,
)
elif m.state == mqtt_ms_wait_for_pubrel:
m.timestamp = now
@@ -3030,7 +3014,7 @@
MQTT_LOG_DEBUG, "Received CONNACK (%s, %s)", flags, result)
# it won't be the first successful connect any more
- self._mqttv5_first_connect == False
+ self._mqttv5_first_connect = False
with self._callback_mutex:
if self.on_connect:
@@ -3047,6 +3031,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_connect:
%s', err)
+ if not self.suppress_exceptions:
+ raise
if result == 0:
rc = 0
@@ -3166,6 +3152,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_subscribe:
%s', err)
+ if not self.suppress_exceptions:
+ raise
return MQTT_ERR_SUCCESS
@@ -3241,7 +3229,10 @@
return MQTT_ERR_PROTOCOL
def _handle_pubrel(self):
- if self._in_packet['remaining_length'] != 2:
+ if self._protocol == MQTTv5:
+ if self._in_packet['remaining_length'] < 2:
+ return MQTT_ERR_PROTOCOL
+ elif self._in_packet['remaining_length'] != 2:
return MQTT_ERR_PROTOCOL
mid, = struct.unpack("!H", self._in_packet['packet'])
@@ -3285,6 +3276,7 @@
m.qos,
m.retain,
m.dup,
+ properties=m.properties,
)
if rc != 0:
return rc
@@ -3352,8 +3344,26 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_unsubscribe:
%s', err)
+ if not self.suppress_exceptions:
+ raise
return MQTT_ERR_SUCCESS
+ def _do_on_disconnect(self, rc, properties=None):
+ with self._callback_mutex:
+ if self.on_disconnect:
+ with self._in_callback_mutex:
+ try:
+ if properties:
+ self.on_disconnect(
+ self, self._userdata, rc, properties)
+ else:
+ self.on_disconnect(self, self._userdata, rc)
+ except Exception as err:
+ self._easy_log(
+ MQTT_LOG_ERR, 'Caught exception in on_disconnect:
%s', err)
+ if not self.suppress_exceptions:
+ raise
+
def _do_on_publish(self, mid):
with self._callback_mutex:
if self.on_publish:
@@ -3363,6 +3373,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_publish:
%s', err)
+ if not self.suppress_exceptions:
+ raise
msg = self._out_messages.pop(mid)
msg.info._set_as_published()
@@ -3413,7 +3425,17 @@
if topic is not None:
for callback in
self._on_message_filtered.iter_match(message.topic):
with self._in_callback_mutex:
- callback(self, self._userdata, message)
+ try:
+ callback(self, self._userdata, message)
+ except Exception as err:
+ self._easy_log(
+ MQTT_LOG_ERR,
+ 'Caught exception in user defined callback
function %s: %s',
+ callback.__name__,
+ err
+ )
+ if not self.suppress_exceptions:
+ raise
matched = True
if matched == False and self.on_message:
@@ -3423,6 +3445,8 @@
except Exception as err:
self._easy_log(
MQTT_LOG_ERR, 'Caught exception in on_message:
%s', err)
+ if not self.suppress_exceptions:
+ raise
def _thread_main(self):
self.loop_forever(retry_first_connection=True)
@@ -3509,7 +3533,7 @@
proxy = self._get_proxy()
addr = (self._host, self._port)
source = (self._bind_address, self._bind_port)
-
+
if sys.version_info < (2, 7) or (3, 0) < sys.version_info < (3, 2):
# Have to short-circuit here because of unsupported source_address
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/src/paho/mqtt/publish.py
new/paho-mqtt-1.5.1/src/paho/mqtt/publish.py
--- old/paho-mqtt-1.5.0/src/paho/mqtt/publish.py 2019-10-30
21:55:05.000000000 +0100
+++ new/paho-mqtt-1.5.1/src/paho/mqtt/publish.py 2020-09-22
20:16:17.000000000 +0200
@@ -21,6 +21,10 @@
from __future__ import absolute_import
import collections
+try:
+ from collections.abc import Iterable
+except ImportError:
+ from collections import Iterable
from . import client as paho
from .. import mqtt
@@ -124,7 +128,7 @@
proxy_args: a dictionary that will be given to the client.
"""
- if not isinstance(msgs, collections.Iterable):
+ if not isinstance(msgs, Iterable):
raise TypeError('msgs must be an iterable')
client = paho.Client(client_id=client_id, userdata=collections.deque(msgs),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/src/paho_mqtt.egg-info/PKG-INFO
new/paho-mqtt-1.5.1/src/paho_mqtt.egg-info/PKG-INFO
--- old/paho-mqtt-1.5.0/src/paho_mqtt.egg-info/PKG-INFO 2019-10-30
22:28:12.000000000 +0100
+++ new/paho-mqtt-1.5.1/src/paho_mqtt.egg-info/PKG-INFO 2020-09-22
20:48:37.000000000 +0200
@@ -1,7 +1,7 @@
Metadata-Version: 2.1
Name: paho-mqtt
-Version: 1.5.0
-Summary: MQTT version 3.1.1 client class
+Version: 1.5.1
+Summary: MQTT version 5.0/3.1.1 client class
Home-page: http://eclipse.org/paho
Author: Roger Light
Author-email: [email protected]
@@ -9,11 +9,11 @@
Description: Eclipse Paho™ MQTT Python Client
================================
- This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 3.1 and 3.1.1 of the MQTT protocol.
+ This document describes the source code for the `Eclipse Paho
<http://eclipse.org/paho/>`_ MQTT Python client library, which implements
versions 5.0, 3.1.1, and 3.1 of the MQTT protocol.
This code provides a client class which enable applications to connect
to an `MQTT <http://mqtt.org/>`_ broker to publish messages, and to subscribe
to topics and receive published messages. It also provides some helper
functions to make publishing one off messages to an MQTT server very
straightforward.
- It supports Python 2.7.9+ or 3.4+, with limited support for Python 2.7
before 2.7.9.
+ It supports Python 2.7.9+ or 3.5+.
The MQTT protocol is a machine-to-machine (M2M)/"Internet of Things"
connectivity protocol. Designed as an extremely lightweight publish/subscribe
messaging transport, it is useful for connections with remote locations where a
small code footprint is required and/or network bandwidth is at a premium.
@@ -1485,9 +1485,10 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Communications
Classifier: Topic :: Internet
Provides-Extra: proxy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/paho-mqtt-1.5.0/src/paho_mqtt.egg-info/SOURCES.txt
new/paho-mqtt-1.5.1/src/paho_mqtt.egg-info/SOURCES.txt
--- old/paho-mqtt-1.5.0/src/paho_mqtt.egg-info/SOURCES.txt 2019-10-30
22:28:12.000000000 +0100
+++ new/paho-mqtt-1.5.1/src/paho_mqtt.egg-info/SOURCES.txt 2020-09-22
20:48:37.000000000 +0200
@@ -13,6 +13,7 @@
examples/client_mqtt_clear_retain.py
examples/client_pub-wait.py
examples/client_pub_opts.py
+examples/client_rpc_math.py
examples/client_session_present.py
examples/client_sub-class.py
examples/client_sub-multiple-callback.py
@@ -26,6 +27,7 @@
examples/publish_multiple.py
examples/publish_single.py
examples/publish_utf8-27.py
+examples/server_rpc_math.py
examples/subscribe_callback.py
examples/subscribe_simple.py
src/paho/__init__.py