pymqtt
pymqtt is a mqtt python client library extension meant to facilitate the integration of a MQTT client into your web application. Basically it is a thin wrapper around the paho-mqtt package to simplify MQTT integration in a python application. MQTT is a machine-to-machine (M2M)/”Internet of Things” (IoT) protocol which is designed as a lightweight publish/subscribe messaging transport. It comes very handy when trying to connect multiple IoT devices with each other or monitor and control these devices from one or multiple clients.
Installing
Install and update using pip:
$ pip install -U pymqtt
A Simple Example
import logging
from flask import Flask
from pymqtt import Mqtt
logging.basicConfig(format='%(asctime)s %(process)d,%(threadName)s %(filename)s:%(lineno)d [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.INFO)
logger = logging.getLogger(__name__)
app = Flask(__name__)
app.config.setdefault('MQTT_IP', '127.0.0.1')
app.config.setdefault('MQTT_PORT', 1883)
app.config.setdefault('MQTT_USER', 'user')
app.config.setdefault('MQTT_PASSWORD', 'password')
fmqtt = Mqtt()
fmqtt.config_from_obj(app.config)
@app.route('/')
def hello_world():
content = 'hello world'
success = fmqtt.publish('hell world', 'topic', qos=2)
return 'send %s success %s' % (content, success)
@fmqtt.subscribe(topic='topic', qos=2)
def flask_rabmq_test(body):
logger.info(body)
return True
if __name__ == '__main__':
fmqtt.run()
app.run()
Metadata
Release files for pymqtt 0.0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pymqtt-0.0.14.tar.gz | 4.7 kB | Without provenance | Details for pymqtt-0.0.14.tar.gz |
Release files / pymqtt-0.0.14.tar.gz
| Download URL | pymqtt-0.0.14.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d5e17e394d40a2947f5389af55df2f65a742cd2cf58a5559fe39bab472e3f0d
|
|
BLAKE2b-256 checksum How to use checksums |
e96e9039d9d5d70c7a4a79d741586e99441d7d7e9f01f256584496f1fae56a17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.8.3 requests/2.27.1 setuptools/59.6.0 requests-toolbelt/0.10.1 tqdm/4.64.1 CPython/3.6.0
|
Security for pymqtt 0.0.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.