Api to download file (Http api RPC_Loadfile)

csJosh

n3wb
May 4, 2023
27
23
United States
Hi,
Has anyone gotten the HTTP api method RPC_Loadfile to work?
Other methods work for me to find files on my NVR, like mediaFileFind.cgi, but when I try RPC_Loadfile, it returns code 200 with empty data. The code I've been using is:
Python:
import requests
from requests.auth import HTTPDigestAuth
#
# [  Omitted code calling mediaFileFind.cgi and related calls to get the files available  ]
#
base = 'https://192.168.4.37:443'
url = base + '/cgi-bin/RPC_Loadfile/mnt/dvr/2023-05-06/2/dav/15/0/0/21759/15.27.33-15.37.06[R][0@0][0].dav'
response = requests.get(url, auth=HTTPDigestAuth(username, password),
                        verify='/home/me/dahua-nvr-server.crt')
assert response.status_code == requests.codes.ok
data = response.content
print(f'Got data of len={len(data)}')

Thanks for any suggestions!
Josh
 
Did you ever get this working? I'm having the same issue and haven't found a solution yet.
I ended up using the Dahua SDK (Dahua Partner Alliances). I use the routines: CLIENT_QueryRecordFile and CLIENT_DownloadByTimeEx to download a DAV clip, and then PLAY_StartAVIConvert to convert the DAV to AVI. It mostly works, though sometimes it refuses to download clips from a certain timestamp and I have to move the timestamp a few seconds earlier or later.
J