Skip to main content

Dahua biometric Python integration library

Project description

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

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

pydahua-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

pydahua-0.1.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file pydahua-0.1.1.tar.gz.

File metadata

  • Download URL: pydahua-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pydahua-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4c73891ade236af0a9accba265b7deb505b24c144bb68949fef5fd74d463da86
MD5 c039c98bd5701f10fa6e97cea3cc35a0
BLAKE2b-256 9aac8352d3a84ef5c934c57b33415728693e97f901be954b7625032d004723fa

See more details on using hashes here.

File details

Details for the file pydahua-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pydahua-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.0

File hashes

Hashes for pydahua-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d5b42bf5e69226395214687b88b25e419a2bbd9afbe1bf1f39ff46ea1d156d02
MD5 83f369175e2844179d23bbb50973ea2e
BLAKE2b-256 953a71c269875c4f1dac9155736bb58cdbcd0ff475438abdb4606b505a5ddec4

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