I'm trying to write a python script to download files from Synology NAS API
url used:
http://IP_ADDRESS:PORT/webapi/entry.cgi?api=SYNO.FileStation.Download&version=2&method=download&path=%2FPATH%2FTO%2FFILE&mode=download&sid=SID
Downloading files from the browser is Ok, so the URL with GET is working, with python I can only get a file with this content, even with status_code of request being 200 OK:
{"error":{"code":119},"success":false}
Methods tried in python:
download = requests.get(download_url, allow_redirects=True)
open('file.csv', 'wb').write(download.content)
and:
x = requests.get(download_url, stream = True)
with open("file.csv", "wb") as csv:
for chunk in x.iter_content(chunk_size=1024):
if chunk:
csv.write(chunk)
without success