Skip to main content

pydahua

Python Version
License
DahuaAPI Python Library for Biometric and Access Control Devices

pydahua is a Python library designed to simplify interaction with Dahua biometric devices and access control systems. It provides a set of high-level methods for managing users, fetching attendance logs, configuring device settings, and handling network or system parameters via HTTP API.


Features

  • Retrieve system information (serial number, hardware version, device type).
  • Manage users:
    • Add, delete, and fetch user information.
    • Enroll new access control cards.
  • Fetch attendance logs and offline records.
  • Configure device settings:
    • Network, language, general system configuration.
    • Snapshot, record, and record mode configuration.
  • Set system time and language.
  • Reboot or shut down devices.
  • Fully compatible with Python 3.10+.
  • Lightweight and dependency minimal (requests only).

Installation

Install via pip:

pip install pydahua

Usage

from pydahua import DahuaAPI
from datetime import datetime

# Initialize the Dahua API client
dahua = DahuaAPI(ip="http://192.168.1.100", username="admin", password="password")

# Get system information
system_info = dahua.get_system_info()
print(system_info)

# Fetch all users
users = dahua.get_user_info_all()
print(users)

# Enroll a new access control card
response = dahua.enroll_new_user(
    card_name="John Doe",
    card_no="123456",
    user_id="JD1001",
    password="Pass@123"
)
print(response)

# Fetch attendance records for a specific card
logs = dahua.get_control_card_rec(
    card_no="123456",
    start_time=datetime(2025, 1, 1, 0, 0, 0),
    end_time=datetime(2025, 1, 18, 23, 59, 59)
)
print(logs)

# Set system time
dahua.set_system_time(date="2025-10-18", time="23:00:00")

Supported Devices

This library works with Dahua biometric and access control devices that support HTTP API endpoints. Confirm your device supports magicBox.cgi, configManager.cgi, userManager.cgi, and recordFinder.cgi endpoints.


Documentation

  • System info: get_system_info(), get_serial_number(), get_hardware_version(), get_device_type()
  • User management: add_user(), delete_user(), get_user_info(), get_user_info_all()
  • Access cards: enroll_new_user(), get_control_card_rec()
  • Logs: fetch_attendance_logs(), get_logs()
  • Configuration: get_general_config(), set_general_config(), get_basic_config(), set_basic_config(), get_record_config(), set_record_config()
  • Time & language: get_system_time(), set_system_time(), get_language_config(), set_language_config()
  • Device operations: reboot_device(), shutdown_device()

Dependencies

  • requests>=2.0

License

This project is licensed under the LGPL 3.0 License.


Author

Sreethul Krishna Email: sreethulkrishna24@gmail.com

Project Links

Release files for pydahua 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydahua 0.1.1
File Size Uploaded
pydahua-0.1.1.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydahua 0.1.1
File Interpreter ABI Platform
pydahua-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / pydahua-0.1.1.tar.gz

Download URL pydahua-0.1.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4c73891ade236af0a9accba265b7deb505b24c144bb68949fef5fd74d463da86
BLAKE2b-256 checksum
How to use checksums
9aac8352d3a84ef5c934c57b33415728693e97f901be954b7625032d004723fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Release files / pydahua-0.1.1-py3-none-any.whl

Download URL pydahua-0.1.1-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5b42bf5e69226395214687b88b25e419a2bbd9afbe1bf1f39ff46ea1d156d02
BLAKE2b-256 checksum
How to use checksums
953a71c269875c4f1dac9155736bb58cdbcd0ff475438abdb4606b505a5ddec4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page