Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listing libraries returns INTERNAL_ERROR #690

Closed
gklka opened this issue Sep 26, 2023 · 7 comments · Fixed by #693
Closed

Listing libraries returns INTERNAL_ERROR #690

gklka opened this issue Sep 26, 2023 · 7 comments · Fixed by #693
Labels

Comments

@gklka
Copy link

gklka commented Sep 26, 2023

Overview

First of all, thank you for the shared libraries support! I was really looking forward for it.

Using --list-libraries switch results the following:

Steps to Reproduce

 $ sudo /opt/icloudpd/bin/icloudpd --directory /mnt/disk7/iCloud \
           --username **** \
           --password **** \
           --list-libraries
2023-09-26 07:49:43 DEBUG    Authenticating...
2023-09-26 07:49:47 ERROR    INTERNAL_ERROR (INTERNAL_ERROR)
Traceback (most recent call last):
  File "/opt/icloudpd/bin/icloudpd", line 8, in <module>
    sys.exit(main())
  File "/opt/icloudpd/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/opt/icloudpd/lib/python3.10/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/opt/icloudpd/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/icloudpd/lib/python3.10/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/opt/icloudpd/lib/python3.10/site-packages/icloudpd/base.py", line 313, in main
    core(
  File "/opt/icloudpd/lib/python3.10/site-packages/icloudpd/base.py", line 767, in core
    libraries_dict = icloud.photos.libraries
  File "/opt/icloudpd/lib/python3.10/site-packages/pyicloud_ipd/services/photos.py", line 277, in libraries
    libraries[zone_name] = PhotoLibrary(
  File "/opt/icloudpd/lib/python3.10/site-packages/pyicloud_ipd/services/photos.py", line 154, in __init__
    request = self.service.session.post(
  File "/opt/icloudpd/lib/python3.10/site-packages/requests/sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/opt/icloudpd/lib/python3.10/site-packages/pyicloud_ipd/base.py", line 105, in request
    self._raise_error(code, reason)
  File "/opt/icloudpd/lib/python3.10/site-packages/pyicloud_ipd/base.py", line 127, in _raise_error
    raise api_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseError: INTERNAL_ERROR (INTERNAL_ERROR)

Expected Behavior

List my shared libraries

Actual Behavior

Throws an exception

Debugging

The JSON I've got (printing in /opt/icloudpd/lib/python3.10/site-packages/pyicloud_ipd/base.py:91):

{'uuid': 'ce2a1472-d930-4b08-b326-35e6b8c74fb2', 'serverErrorCode': 'INTERNAL_ERROR', 'errorClass': 'INTERNAL_ERROR', 'error': 'INTERNAL_ERROR'}
2023-09-26 08:25:16 ERROR    INTERNAL_ERROR (INTERNAL_ERROR)
@fver
Copy link
Contributor

fver commented Sep 26, 2023

Sorry, can't reproduce on my side.
I did see that this was 'fixed' by using a different query string, (icloud-photos-downloader/pyicloud#8 (comment))
I can try to build this, what is the easiest form for you to test this?

@gus-abreu
Copy link

gus-abreu commented Sep 26, 2023

On the road with only a Windows machine, but I was able to reproduce:

PS C:\Users\gTo\Downloads> .\icloudpd-1.16.0-windows-amd64.exe --list-libraries
iCloud username/email: ******
2023-09-26 09:59:14 DEBUG    Authenticating...
iCloud Password:
2023-09-26 09:59:27 ERROR    INTERNAL_ERROR (INTERNAL_ERROR)
Traceback (most recent call last):
  File "starters\icloudpd.py", line 5, in <module>
  File "click\core.py", line 1157, in __call__
  File "click\core.py", line 1078, in main
  File "click\core.py", line 1434, in invoke
  File "click\core.py", line 783, in invoke
  File "icloudpd\base.py", line 313, in main
  File "icloudpd\base.py", line 767, in core
  File "pyicloud_ipd\services\photos.py", line 277, in libraries
  File "pyicloud_ipd\services\photos.py", line 154, in __init__
  File "requests\sessions.py", line 637, in post
  File "pyicloud_ipd\base.py", line 105, in request
  File "pyicloud_ipd\base.py", line 127, in _raise_error
pyicloud_ipd.exceptions.PyiCloudAPIResponseError: INTERNAL_ERROR (INTERNAL_ERROR)
[20588] Failed to execute script 'icloudpd' due to unhandled exception!
PS C:\Users\gTo\Downloads> .\icloudpd-1.16.0-windows-amd64.exe --list-albums
iCloud username/email: *****
2023-09-26 10:01:38 DEBUG    Authenticating...
iCloud Password:
2023-09-26 10:01:48 ERROR    INTERNAL_ERROR (INTERNAL_ERROR)
2023-09-26 10:01:48 ERROR    error?? INTERNAL_ERROR (INTERNAL_ERROR)
PS C:\Users\gTo\Downloads> .\icloudpd-1.16.0-windows-amd64.exe -d . --dry-run
iCloud username/email: *****
2023-09-26 10:02:45 DEBUG    Authenticating...
iCloud Password:
2023-09-26 10:02:54 ERROR    INTERNAL_ERROR (INTERNAL_ERROR)
2023-09-26 10:02:54 ERROR    error?? INTERNAL_ERROR (INTERNAL_ERROR)

Works as expected using 1.15.1:

PS C:\Users\gTo\Downloads> .\icloudpd-1.15.1-windows-amd64.exe --list-albums
iCloud username/email: *****
2023-09-26 10:08:31 DEBUG    Authenticating...
iCloud Password:
All Photos
Time-lapse
[...]

@fver
Copy link
Contributor

fver commented Sep 26, 2023

How do we proceed? I can create a new PR or produce a new build (with the previously proposed fix) but cannot verify this myself since unable to reproduce it.

@gklka
Copy link
Author

gklka commented Sep 26, 2023

Tonight I will test the change you mentioned, and report if it is working. Let me know if I can help you in anything more.

@gklka
Copy link
Author

gklka commented Sep 26, 2023

Changing the URL in libraries() call in pyicloud_ipd/services/photos.py:261 to url = ('%s/zones/list' % worked!

Now both --list-libraries and sync using --library <received id> works!

fver added a commit to fver/icloud_photos_downloader that referenced this issue Sep 26, 2023
@fver
Copy link
Contributor

fver commented Sep 26, 2023

good news, adapted code and tests. Tried to update the pull request.

fver added a commit to fver/icloud_photos_downloader that referenced this issue Sep 27, 2023
@fver
Copy link
Contributor

fver commented Sep 27, 2023

PR submitted, could not do any further testing on this. If somebody has an idea how to better validate this, please let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants