danielfernau / unifi-protect-video-downloader

Tool for downloading footage from a local UniFi Protect system
https://ui-protect-dl-docs.danielfernau.com/
MIT License
477 stars 55 forks source link

Connection failure (ssh problem) #274

Closed pete-os closed 1 year ago

pete-os commented 1 year ago

Hi

I've just discovered your tool and its just what I need!

Tried running the container on a Mac (Ventura) / Docker Desktop 14.16.2 and I get the following error when trying to connect to my UDMP:

`Getting camera list Authentication failed with status code 403! Check username and password. Traceback (most recent call last): File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/download.py", line 211, in download camera_list = client.get_camera_list() File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/init.py", line 87, in get_camera_list return Downloader.get_camera_list(self.session) File "/usr/local/lib/python3.8/site-packages/protect_archiver/downloader/init.py", line 33, in get_camera_list return get_camera_list(session) File "/usr/local/lib/python3.8/site-packages/protect_archiver/downloader/get_camera_list.py", line 19, in get_camera_list cookies={"TOKEN": session.get_api_token()}, File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/unifi_os.py", line 61, in get_api_token self._api_token = self.fetch_session_cookie_token() File "/usr/local/lib/python3.8/site-packages/protect_archiver/client/unifi_os.py", line 47, in fetch_session_cookie_token raise Errors.ProtectError(2) TypeError: 'Exception' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/bin/protect-archiver", line 8, in sys.exit(main()) File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/init.py", line 21, in main cli.main() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, *ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "/usr/local/lib/python3.8/site-packages/protect_archiver/cli/download.py", line 238, in download except Errors.ProtectError as e: TypeError: catching classes that do not inherit from BaseException is not allowed'

The username/password that I used is correct - works directly from the shell (but I do have to use HostKeyAlgorithms=+ssh-rsa as the Ventura ssh configuration does not include ssh-rsa by default anymore)

Any ideas?

There also seems to be a secondary issue re: exception handling?

Thanks

Pete

danielfernau commented 1 year ago

Hi @pete-os

Sorry for the delayed response. Am I correct to assume that you're trying to use username and password/key of the SSH account, not a local user account? If so, please note that this tool uses the Protect API (just like the web page or mobile app) to access and interact with the system. It does neither use SSH nor rsync in the background. To successfully archive footage from your UNVR, please add a local user account as described here: https://github.com/danielfernau/unifi-protect-video-downloader/wiki/Basic-Usage#general

Regarding the error handling, yes, there's a little bit of code cleanup required -- I just haven't had enough time in the past to do something about that :)

Feel free to reach out in case you have any additional questions!

Best Daniel

pete-os commented 1 year ago

Hi Daniel

Works fine with a local-only account - thanks for that! I was using a ubiquiti + local account previously.

Thanks

Pete