Skip to main content

IoT Edge Validator Library for Python

Project description


python version pre-commit Keep a Changelog CI_CD GitHub_Actions package PyPI azure-iot-device

This package is a wrapper around the azure-iot-device SDK to provide standardized exception handling and direct method request validation.

Official Documentation | Source code | Package PyPI

Table of Contents


This repository adheres to Semantic Versioning. It will be maintained through the and in GitHub Releases. It's important to note that you must maintain the version with your releases in iot/edge/validator/, otherwise a new package version will fail to get published.

Getting Started

This section provides basic examples with the iot-edge-validator.


  • Python 3.7 or later is required to use this package.

  • You must have an Azure subscription and Azure IoT Edge Device to use this package.

Basic Examples

  1. Install via pip:

    pip install iot-edge-validator
  2. Import and say hello:

    from iot.edge.validator import __version__
    print(f"hello world from iot-edge-validator version: {__version__}")
  3. Basic usage:

    from typing import Any, Dict, Union
    from azure.iot.device.iothub.models.methods import MethodRequest, MethodResponse
    from iot.edge.validator import (
    EXPECTED_METHOD_NAME: str = "some_method_name"
    EXPECTED_METHOD_PAYLOAD: Dict[str, Any] = {
        "some": {},
        "expected": {},
        "payload": {},
    def validate_method_requests(method_request: MethodRequest) -> Union[MethodResponse, None]:
        """validation handler for some_method_name listener"""
            return generate_error_response(method_request,
                f"received unknown method request for {}",
    def validate_some_method_name_request(method_request: MethodRequest) -> Union[MethodResponse, None]:
        """validation for expected payload of some_method_name direct method request"""
        # top level basic format validation
        error_msg = compare_dictionary(
        if error_msg:
            return generate_error_response(
                method_request, f"error parsing payload: {error_msg}", 400
        return None

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iot-edge-validator-1.0.4.tar.gz (4.9 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page