معرفی شرکت ها


astarte-device-sdk-0.11.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Astarte Device SDK for Python
ویژگی مقدار
سیستم عامل -
نام فایل astarte-device-sdk-0.11.0
نام astarte-device-sdk
نسخه کتابخانه 0.11.0
نگهدارنده []
ایمیل نگهدارنده []
نویسنده Francesco Vaiani
ایمیل نویسنده francesco.vaiani@secomind.com
آدرس صفحه اصلی https://github.com/astarte-platform/astarte-device-sdk-python
آدرس اینترنتی https://pypi.org/project/astarte-device-sdk/
مجوز License :: OSI Approved :: Apache Software License
# Astarte Python Device SDK Python Device SDK for [Astarte](https://github.com/astarte-platform/astarte). Create Astarte Devices and Simulators with Python3. It integrates with asyncio to ensure a smooth developer experience and to hide complex details regarding threading and MQTT interactions. ## How to get with Pip The Astarte device SDK can be obtained by running: ``` pip install astarte-device-sdk ``` ## Basic usage ### Create a device Initializing an instance of a device can be performed in three steps, as seen below. ```python from astarte.device import Device # Create the device instance device = Device( device_id="device id", realm="realm", credentials_secret="credentials secret", pairing_base_url="pairing url", persistency_dir=".", loop=None, ignore_ssl_errors=False, ) # Add all the interfaces for this device for interface in interfaces: device.add_interface(interface) # Connect to Astarte device.connect() ``` ### Publish data from device Publishing new values can be performed using the `send` and `send_aggregate` functions. ```python from astarte.device import Device from datetime import datetime, timezone # ... Create a device and connect it to Astarte ... # Send an individual datastream or a property device.send( interface_name="datastream_interface", interface_path=f"/path/name", payload="payload", timestamp=None, ) # Send an aggregated object datastream payload = {"endpoint1": "value1", "endpoint2": 42} device.send_aggregate( interface_name="aggregate_interface", interface_path=f"/path/name", payload=payload, timestamp=datetime.now(tz=timezone.utc), ) ``` ### Receive a server publication The device automatically polls for new messages. The user can use a call back function to process received data. Callback functions are also available for connect/disconnect events. ```python from astarte.device import Device def my_callback(device: Device, name: str, path: str, payload: dict): print(f"Received message for {name}{path}: {payload}") # ... Create a device and connect it to Astarte ... # Setup the callback device.on_data_received = my_callback # Keep the program running while True: pass ```


نیازمندی

مقدار نام
>=2.22.0 requests
- paho-mqtt
- cryptography
- bson
>=1.7.0 PyJWT
- termcolor
- python-dateutil


زبان مورد نیاز

مقدار نام
>=3.6 Python


نحوه نصب


نصب پکیج whl astarte-device-sdk-0.11.0:

    pip install astarte-device-sdk-0.11.0.whl


نصب پکیج tar.gz astarte-device-sdk-0.11.0:

    pip install astarte-device-sdk-0.11.0.tar.gz