Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[paho-dev] Python publish single()

Hi all,

I've just had a reminder that I've not publicised something I added to
the Python client code recently.

I've added a new module which is for helper functions for publishing.
It can be accessed with e.g.

import paho.mqtt.publish as publish

At the moment the only function that exists is single(). This blocking
function connects to a broker, publishes a single message and
disconnects cleanly. I'm using it myself in a script that runs once an
hour to scrape a single value from a webpage and publish it. I'm sure
you can think of other applications.

The code (including the documentation) looks like this:

and there is an example here:

The version of the code on pypi has this new module, so you can
install with "pip install paho-mqtt" if you wish, without having to
deal with git.

I anticipate another function multiple() coming along in the future.



Back to the top