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.0.tar.gz (8.4 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.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pydahua-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 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.0.tar.gz
Algorithm Hash digest
SHA256 191383b3e9ab63449c97e90beacd833ee1e05f12850d235cf0a60303c01912bc
MD5 cd82cc350089bcb0e0fc8d0a90f97ecd
BLAKE2b-256 715ef8883e47042e1bb179c776067ca6b4c3f8facb0715ff7581c7c53f1f5fb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydahua-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 479b0833831b24046e013f5226049d7425bb6d93e7dfbe205d741e63e07b4cf2
MD5 0d1aa49a3250ade99d5ccdfb9c4b824f
BLAKE2b-256 c402f0eef4842548961fa059f500f4bb4447fa74874474ad5808a88e1dee6e77

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