azure-iot-hub-api
Azure IoT hub api interface using azure cli
This package is alternative to azure-iot-hub which hasn't had any updates in several years and relays on the deprecated azure-uamqp-python.
This package can be used as a stopgap until the azure-iot-hub been updated to no longer depend on deprecated packages.
Currently these very basic functionalities of the IoTHubRegistryManager are supported:
- create_device_with_sas
- get_twin
- get_twins
- update_twin
- get_device
- get_devices
- delete_device
The package are designed, so that, if it is used as alternative to existing azure-iot-hub in the project, it need to make only little changes to the codebase.
Usage
Install package :
pip install azure-iot-hub-api
Simply import and create IoTHubRegistryManager using connection string, then you can call api functions.
Sample code
from azure_iot_hub_api import IoTHubRegistryManager
AZURE_IOT_CONNECTION_STRING = "HostName=MyAzureIotHub.azure-devices.net;SharedAccessKeyName=xxx;SharedAccessKey=xxxxxxxxxxxxxx"
registry_manager = IoTHubRegistryManager(AZURE_IOT_CONNECTION_STRING)
my_device_id = 'E-11'
primary_key = 'primary-base64-key'
secondary_key = 'secondary-base64-key'
# Create a device
registry_manager.create_device_with_sas(
device_id=my_device_id,
primary_key=primary_key,
secondary_key=secondary_key,
status='enabled',
)
# Get device twin
my_device_twin = registry_manager.get_twin(device_id=my_device_id)
my_device_twin.properties.desired['speed'] = 70
# Update device twin (It updates only desired object)
registry_manager.update_twin(device_id=my_device_id, twin=my_device_twin)
Metadata
Release files for azure-iot-hub-api 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| azure_iot_hub_api-0.2.2.tar.gz | 9.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| azure_iot_hub_api-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.3 kB
Release files / azure_iot_hub_api-0.2.2.tar.gz
| Download URL | azure_iot_hub_api-0.2.2.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
67ffa7b16c4e14a5501455a2a3920753d63cb4def80b1718291ceb9783409c0c
|
|
BLAKE2b-256 checksum How to use checksums |
a50afb9834b2ad5c22d0416b72b94b5a574466ed3438e9c26a47d0b06dcb6ba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / azure_iot_hub_api-0.2.2-py3-none-any.whl
| Download URL | azure_iot_hub_api-0.2.2-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
827727481f84babe82167df804a8708343800888a7772e38d7ac5ac36777b9ef
|
|
BLAKE2b-256 checksum How to use checksums |
11c354409dd2fd520e4f97c3dade1ed7339210ff595e99495da34c2ddba92fbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|