python-synology
python-synology copied to clipboard
Failed to authenticate after upgrade to DSM 7
After synology upgrade to DSM 7, the _initialize_api_sid fails on
Traceback (most recent call last):
File "synology-snapshot.py", line 34, in <module>
surveillance = SurveillanceStation(api_url, username, password, verify_ssl=verify_ssl, timeout=timeout)
File "/root/synology-snapshot-docker/.venv/lib/python3.8/site-packages/synology/surveillance_station.py", line 13, in __init__
self._api = Api(url, username, password, timeout, verify_ssl)
File "/root/synology-snapshot-docker/.venv/lib/python3.8/site-packages/synology/api.py", line 74, in __init__
self._initialize_api_sid()
File "/root/synology-snapshot-docker/.venv/lib/python3.8/site-packages/synology/api.py", line 102, in _initialize_api_sid
response = self._get_json_with_retry(api['url'], payload)
File "/root/synology-snapshot-docker/.venv/lib/python3.8/site-packages/synology/api.py", line 303, in _get_json_with_retry
return self._get_json(url, payload)
File "/root/synology-snapshot-docker/.venv/lib/python3.8/site-packages/synology/api.py", line 318, in _get_json
raise ValueError('Invalid or failed response', content)
ValueError: ('Invalid or failed response', {'error': {'code': 103}, 'success': False})
Based on WebAPi documentation it seems like the requested API method doesn't exist.
_api_info structure:
{'_api_info': {'auth': {'name': 'SYNO.API.Auth', 'url': 'https://IP:5001/webapi/entry.cgi', 'version': 2},
'camera': {'name': 'SYNO.SurveillanceStation.Camera', 'url': 'https://IP:5001/webapi/entry.cgi', 'version': 1},
'camera_event': {'name': 'SYNO.SurveillanceStation.Camera.Event', 'url': 'https://IP:5001/webapi/entry.cgi', 'version': 1},
'home_mode': {'name': 'SYNO.SurveillanceStation.HomeMode', 'url': 'https://IP:5001/webapi/entry.cgi', 'version': 1},
'snapshot': {'name': 'SYNO.SurveillanceStation.SnapShot', 'url': 'https://IP:5001/webapi/entry.cgi', 'version': 1},
'video_stream': {'name': 'SYNO.SurveillanceStation.VideoStream', 'url': 'https://IP:5001/webapi/SurveillanceStation/videoStreaming.cgi', 'version': 1}},
'_base_url': 'https://IP:5001/webapi/',
'_password': 'foo',
'_sid': None,
'_timeout': 30,
'_username': 'bar',
'_verify_ssl': False}
(Pdb++)
Surveillance station version: 8.2.9-7301 https://www.synology.com/en-uk/releaseNote/SurveillanceStation
I've bumped the SYNO.API.Auth to 7 and changed the login method from "Login" to "login" and it started working. Looks like we need some api discovery to setup proper parameters.