drift-mqtt-0.2.0
توضیحات
A wrapper around Python Paho Mqtt library
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | drift-mqtt-0.2.0 |
| نام | drift-mqtt |
| نسخه کتابخانه | 0.2.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | PANDA, GmbH |
| ایمیل نویسنده | info@panda.technology |
| آدرس صفحه اصلی | https://gitlab.panda.technology/drift/sdk/drift-mqtt |
| آدرس اینترنتی | https://pypi.org/project/drift-mqtt/ |
| مجوز | - |
# Drift MQTT tools
[](https://github.com/panda-official/DriftMqtt/actions)


A collection of helpers to work with MQTT:
* `Client` - wrapper around `paho.mqtt.Client` that correctly handles subscriptions after reconnect
## Installation
```bash
pip install drift-mqtt
```
Or get the latest version from GitHub:
```bash
pip install git+https://github.com/panda-official/DriftMqtt.git
```
## Usage
Producer
```python
from drift_mqtt import Client
client = Client('tcp://127.0.0.1:8000', 'client_id')
client.connect()
client.loop_start()
...
client.publish('topic', 'some message')
```
Consumer
```python
from drift_mqtt import Client
def message_handler(message):
print('Got message ', message.payload, message.topic)
client = Client('tcp://127.0.0.1:8000', client_id='test_subscriber')
client.subscribe('test_topic', message_handler)
client.connect()
client.loop_forever()
```
For more details please check `examples/` folder
نیازمندی
| مقدار | نام |
|---|---|
| ~=1.6.0 | paho-mqtt |
| ~=22.8.0 | black |
| ~=2.15.3 | pylint |
| ~=7.1.3 | pytest |
| ~=3.8.2 | pytest-mock |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl drift-mqtt-0.2.0:
pip install drift-mqtt-0.2.0.whl
نصب پکیج tar.gz drift-mqtt-0.2.0:
pip install drift-mqtt-0.2.0.tar.gz