MQTT Router
MQTT Router is a simple to use client-agnostic mqtt message router.
You can use mqtt-router to declare mqtt message handlers using a simple and minimal python decorator syntax.
mqtt-router helps you extract parameters from topics that contains wildcards and cast those parameters into the desired python data type.
Getting Started
Install the library using Pip:
pip install mqtt-router
Using mqtt-router
from mqtt_router import MQTTRouter
router = MQTTRouter()
# Subscribe to telemetry/#/#/data
@router.add("telemetry/<str:streaming_key>/<int:count>/data")
def handle_meta(message, context, streaming_key=None, count=None):
...
# Subscribe to telemetry/+
@router.add("telemetry/<path:rest>")
def handle_rest(message, context, rest=None):
...
def on_message(message, topic, client, userdata):
router.route(topic, message, context={"client": client, "userdata": userdata})
mqtt_client.on_message = on_message
Metadata
Release files for mqtt-router 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mqtt-router-0.1.3.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mqtt_router-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.5 kB
Release files / mqtt-router-0.1.3.tar.gz
| Download URL | mqtt-router-0.1.3.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4676e1b901015d9d45631fc3cfd4a3e9cdaef81046993ea9dd4ac9eda083d097
|
|
BLAKE2b-256 checksum How to use checksums |
0e8c5272f97cbbd907eaecbf82de6e3feb1b93ddbd7bbbef69f149dc43024848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / mqtt_router-0.1.3-py3-none-any.whl
| Download URL | mqtt_router-0.1.3-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
735b6264f8e66bbfe19c5b30b2f9c8e3e33fd61c13c26b01f2ea7851d03d41c7
|
|
BLAKE2b-256 checksum How to use checksums |
530ddea727d0aeac5506249e6ba3496023e2e806755102476c47e185cd7a6863
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|