Skip to main content

SDK for interacting with Dahua NVRs over their peer-to-peer protocol.

Project description

OpenDahua

PyPI - Version GitHub License

Python SDK for interacting with Dahua NVRs (Network Video Recorders) over their proprietary peer-to-peer protocol.

Installation

You can install OpenDahua with your favorite python package manager!

pip install opendahua

or

uv add opendahua

Usage

[!WARNING] Within the async with DahuaNVR(xxx) as nvr: block you should use async for all IO operations. The peer-to-peer connection might die if you don't do this.

import asyncio
from datetime import datetime, timedelta

from opendahua import DahuaNVR


async def main() -> None:
    async with DahuaNVR("SERIAL_NUMBER_HERE", "USERNAME_HERE", "PASSWORD_HERE") as nvr:
        all_video = await nvr.get_videos(
            channel=1,
            time_start=datetime.now() - timedelta(days=1),
        )
        
        for video in all_video:
            path = await nvr.download_video(video, "videos/")
            
            # Example: videos/ExampleNVR_ch1_20260601135935_20260601140002.dav
            print(f"Video path: {path}")
        
if __name__ == "__main__":
    asyncio.run(main())

Special thanks to

  • khoanguyen-3fc/dh-p2p: The reverse engineering work and proof-of-concept that make this project possible.

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

opendahua-1.0.7.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

opendahua-1.0.7-py3-none-any.whl (65.7 kB view details)

Uploaded Python 3

File details

Details for the file opendahua-1.0.7.tar.gz.

File metadata

  • Download URL: opendahua-1.0.7.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for opendahua-1.0.7.tar.gz
Algorithm Hash digest
SHA256 d785de9378faa5c11223abeec455d916b661be4c41cc74989f2a201fa32be140
MD5 162ddda63ff5667338d52da9d9b4f87e
BLAKE2b-256 2c854983f3dd5346c04f3899ac77bd188d0d614262beb798b2d84f7469b8cb33

See more details on using hashes here.

File details

Details for the file opendahua-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: opendahua-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 65.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for opendahua-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4030772fe00a9e14b147b3e34c13ed18c15aa3f8a19a1b0e1908d7f4169d65ae
MD5 bc19ea9b668ff304dd6d849d069a8776
BLAKE2b-256 1d5207388b5293396b2e41392d968f60510e60390861a5e705c93c267410c782

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