azure-iot-hub-api


Nameazure-iot-hub-api JSON
Version 0.2.0 PyPI version JSON
download
home_pagehttps://github.com/birddevelper/azure-iot-hub-api
SummaryAzure iot hub api with azure cli backend
upload_time2024-04-20 20:56:59
maintainerNone
docs_urlNone
authorM.Shaeri
requires_pythonNone
licenseGNU
keywords azure iot azure iot hub azure cli
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # azure-iot-hub-api
Azure IoT hub api interface using azure cli

This package is alternative to [azure-iot-hub](https://pypi.org/project/azure-iot-hub/) which hasn't had any updates in several years and relays on the deprecated [azure-uamqp-python](https://github.com/Azure/azure-uamqp-python).

This package can be used as a stopgap until the [azure-iot-hub](https://pypi.org/project/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

Simply import and create IoTHubRegistryManager using connection string, then you can call api functions.

## Sample code

```python
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)

```






            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/birddevelper/azure-iot-hub-api",
    "name": "azure-iot-hub-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "Azure, IoT, Azure IoT hub, azure cli",
    "author": "M.Shaeri",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/2c/85/0d03cfdd3e75d2f495dfc3cfe0e8d7056cee9fd48d03cfcbc0f677a9094b/azure_iot_hub_api-0.2.0.tar.gz",
    "platform": null,
    "description": "# azure-iot-hub-api\nAzure IoT hub api interface using azure cli\n\nThis package is alternative to [azure-iot-hub](https://pypi.org/project/azure-iot-hub/) which hasn't had any updates in several years and relays on the deprecated [azure-uamqp-python](https://github.com/Azure/azure-uamqp-python).\n\nThis package can be used as a stopgap until the [azure-iot-hub](https://pypi.org/project/azure-iot-hub/) been updated to no longer depend on deprecated packages.\n\nCurrently these very basic functionalities of the **IoTHubRegistryManager** are supported:\n\n- **create_device_with_sas**\n- **get_twin**\n- **get_twins**\n- **update_twin**\n- **get_device**\n- **get_devices**\n- **delete_device**\n\nThe 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.\n\n## Usage\n\nSimply import and create IoTHubRegistryManager using connection string, then you can call api functions.\n\n## Sample code\n\n```python\nfrom azure_iot_hub_api import IoTHubRegistryManager\n\nAZURE_IOT_CONNECTION_STRING = \"HostName=MyAzureIotHub.azure-devices.net;SharedAccessKeyName=xxx;SharedAccessKey=xxxxxxxxxxxxxx\"\nregistry_manager = IoTHubRegistryManager(AZURE_IOT_CONNECTION_STRING)\nmy_device_id = 'E-11'\nprimary_key = 'primary-base64-key'\nsecondary_key = 'secondary-base64-key'\n\n# Create a device\nregistry_manager.create_device_with_sas(\n        device_id=my_device_id,\n        primary_key=primary_key,\n        secondary_key=secondary_key,\n        status='enabled',\n    )\n\n# Get device twin\nmy_device_twin = registry_manager.get_twin(device_id=my_device_id)\nmy_device_twin.properties.desired['speed'] = 70\n\n# Update device twin (It updates only desired object)\nregistry_manager.update_twin(device_id=my_device_id, twin=my_device_twin)\n\n```\n\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "GNU",
    "summary": "Azure iot hub api with azure cli backend",
    "version": "0.2.0",
    "project_urls": {
        "Download": "https://github.com/birddevelper/azure-iot-hub-api",
        "Homepage": "https://github.com/birddevelper/azure-iot-hub-api"
    },
    "split_keywords": [
        "azure",
        " iot",
        " azure iot hub",
        " azure cli"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "98217048742368e7332bd414902f9d98572c36f7c6c04616c2ee9e3ef4316d78",
                "md5": "e62ad9b24b2f80fabee7c8b0216ef7c4",
                "sha256": "d3d9d3c6c6950a2991e9421fae46bd12d47b671c35e8e32320712d137bcb8fe4"
            },
            "downloads": -1,
            "filename": "azure_iot_hub_api-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e62ad9b24b2f80fabee7c8b0216ef7c4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9836,
            "upload_time": "2024-04-20T20:56:57",
            "upload_time_iso_8601": "2024-04-20T20:56:57.623771Z",
            "url": "https://files.pythonhosted.org/packages/98/21/7048742368e7332bd414902f9d98572c36f7c6c04616c2ee9e3ef4316d78/azure_iot_hub_api-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2c850d03cfdd3e75d2f495dfc3cfe0e8d7056cee9fd48d03cfcbc0f677a9094b",
                "md5": "762a683cf0050ce3bf76d320da0098d0",
                "sha256": "1cea3c76e5bdbfa6993c13265701cb7f131e54a55ee4867424b6605f34551be3"
            },
            "downloads": -1,
            "filename": "azure_iot_hub_api-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "762a683cf0050ce3bf76d320da0098d0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 9104,
            "upload_time": "2024-04-20T20:56:59",
            "upload_time_iso_8601": "2024-04-20T20:56:59.164864Z",
            "url": "https://files.pythonhosted.org/packages/2c/85/0d03cfdd3e75d2f495dfc3cfe0e8d7056cee9fd48d03cfcbc0f677a9094b/azure_iot_hub_api-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-20 20:56:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "birddevelper",
    "github_project": "azure-iot-hub-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "azure-iot-hub-api"
}
        
Elapsed time: 0.29848s