Skip to main content

A Python library for the EZVIZ OpenAPI platform, handling authentication and API requests.

Project description

EZVIZ OpenAPI Utils

简体中文 | English

A Python library designed to simplify interactions with the EZVIZ OpenAPI platform. It handles authentication, automatic token refreshing, and provides a clean, unified interface for all API endpoints.

✨ Key Features

  • Automatic Token Management: The client automatically handles Access Token expiration and renewal, requiring no manual intervention from the user.
  • Multi-Region Support: Fully supports all 8 global regions (cn, en, eu, us, sa, sg, in, ru), ensuring compatibility worldwide.
  • Type Safe: Uses TypedDict for API responses, providing excellent IDE support and code completion for developers.
  • Clean Architecture: Clearly separates concerns: Client handles authentication, and EZVIZOpenAPI handles API calls, resulting in a codebase that is easy to understand and maintain.

📦 Installation

First, install the core dependency requests.

pip install requests

(Note: This project uses pyproject.toml for dependency management. For a full development environment, use pip install -e .[dev].)

🚀 Getting Started

from ezviz_openapi_utils import Client, EZVIZOpenAPI

# 1. Create a client instance (automatically fetches the access token)
client = Client(
    app_key="YOUR_APP_KEY",
    app_secret="YOUR_APP_SECRET",
    region="cn"  # Specify your region
)

# 2. Create an API instance
api = EZVIZOpenAPI(client)

# Add a device
add_device_response = api.add_device(device_serial="427734888", validate_code="ABCDEF")
print(add_device_response)
# Output: {'code': '200', 'msg': 'Operation succeeded!'}

# Get device information
device_info_response = api.get_device_info(device_serial="427734888")
print(device_info_response)
# Output: {'data': {'deviceSerial': '427734888', 'deviceName': 'niuxiaoge device', 'model': 'CS-C1-11WPFR', 'status': 0, 'defence': 1, 'isEncrypt': 0}, 'code': '200', 'msg': 'Operating succeeded!'}

# Delete a device
delete_response = api.delete_device(device_serial="427734888")
print(delete_response)
# Output: {'code': '200', 'msg': 'Operation succeeded!'}

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

ezviz_openapi_utils-0.1.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezviz_openapi_utils-0.1.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file ezviz_openapi_utils-0.1.0.tar.gz.

File metadata

  • Download URL: ezviz_openapi_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ezviz_openapi_utils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 655c0b28b5e9e201e67eb52a156abd4a70638644f52a5f9365ec3665eb0ef28f
MD5 a2d10ded4525c6654b2404e247ec78aa
BLAKE2b-256 6f2534af2ab785ee82a826710c21f453207a7c399c6ca400e47fa60eff2808b8

See more details on using hashes here.

File details

Details for the file ezviz_openapi_utils-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ezviz_openapi_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fac55dd4ff5d56a9bf3cd64181659b81bc20260aac6f3644967ea8e9ba802455
MD5 d91f1a18f53d927f54ed8bd801edd518
BLAKE2b-256 47370ef9f937edea5c9bb33a71409bfe086c63025c744ba5954335d5c8415e88

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page