No project description provided
Project description
django-mqtt
MQTT tools for Django project
Usage
- Add
"dmqtt"to yourINSTALLED_APPS - Add
MQTT_HOST,MQTT_USER,MQTT_PASS,MQTT_PORT - Run with
python manage.py mqtt
from dmqtt.signals import connect, regex, topic
from django.dispatch import receiver
@receiver(connect)
def on_connect(sender, **kwargs):
sender.subscribe("#")
@topic("some/mqtt/topic")
def simple_topic(sender, topic, data, **kwargs):
print(topic)
print(data)
@regex("^some/(?P<username>[^/]+)/(?P<device>[^/]+)$")
def regex_topic(match, data, **kwargs):
device = match.groupdict()
print(device['username'], device['device])
print(data)
Authentication
mosquitto-go-auth
Used with https://github.com/iegomez/mosquitto-go-auth
# From example project urls
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("mosquitto/", include("dmqtt.mosquitto")),
path("account/", include(("django.contrib.auth.urls", "auth"), namespace="auth")),
path("admin/", admin.site.urls),
]
# mosquitto configuration
# https://github.com/iegomez/mosquitto-go-auth#http
auth_plugin /mosquitto/go-auth.so
auth_opt_backends http
auth_opt_check_prefix false
auth_opt_http_host example.com
auth_opt_http_getuser_uri /mosquitto/getuser
auth_opt_http_aclcheck_uri /mosquitto/aclcheck
# If using https
auth_opt_http_port 443
auth_opt_http_with_tls true
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_mqtt-0.6.0.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_mqtt-0.6.0.tar.gz.
File metadata
- Download URL: django_mqtt-0.6.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1afc3aa0e92c4eba184aad376f5b91df823aff73ada54153a43230953c472b5
|
|
| MD5 |
5e2cb9ae6f3711964d42fccfd8426fdc
|
|
| BLAKE2b-256 |
cfc2b77ba32e3e31c47e9eb26f887c1b20b883c259bf7c6b14f99e157bace345
|
File details
Details for the file django_mqtt-0.6.0-py3-none-any.whl.
File metadata
- Download URL: django_mqtt-0.6.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e37c8ebefa4ddfa85530f23f4b5b74ee472670f0a08decb89135d816a17a49f9
|
|
| MD5 |
8ac65c16287986f5c34d96d84df23ef9
|
|
| BLAKE2b-256 |
ee0126e26a73a4655956f0c5babf65de209e819f126236d4159273b81e32c360
|