I'm reading the documentation for Paho MQTT's Publish
module, and thinking of my application in which I might have to publish many single
messages, each with similar keyword arguments. The calls look similar to the following:
paho.mqtt.publish.single('dummy_topic', payload=dummy_payload, qos=0, retain=False,
auth={'username': "dummy_username", 'password': "dummy_password"},
hostname=config['mqtt_host'], port=int(config['mqtt_port']), tls=dummy_tls)
In order to keep my code DRY, I'm trying to think of a way to persist the keyword arguments across different single
commands.
For HTTP requests, Python's requests module has the Sessions object which allows one to do this. Is there something similar for Paho MQTT, or shall I instead use something like partial
from the functools module?