Api to download file (Http api RPC_Loadfile)

csJosh

n3wb
May 4, 2023
26
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