Skip to content

Conversation

@ebob9
Copy link

@ebob9 ebob9 commented Nov 12, 2024

Proposed change

Moving files to trash and creating directories when using iCloud Drive functions throws errors on lacking clientId. There are lots of bugs filed (#384 , #366, #326, and others) on this.

Most of these bugs suggest using the api.client_id value as the params, which does work.

However, looking at icloud.com API interactions, it appears that the correct way to do this is as follows:

  • create_folders() -> icloud.com uses a clientId of the format FOLDER::UNKNOWN_ZONE::TempId-<random uuid4> when making this call.
  • move_items_to_trash() - icloud.com sends the clientId with the same value as the node_id.

I replicated the icloud behavior instead of using the actual api.client_id, as that seems to be the right thing to do.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New service (thank you!)
  • New feature (which adds functionality to an existing service)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests
  • Documentation or code sample

Example of code:

# create a DriveNode object, and create a directory, then move it to trash.
# assume authenticated api object..
test1 = api.drive.root
test1.mkdir('test_dir')
test1['test_dir'].delete()

Additional information

  • This PR fixes or closes issue: fixes #384 , #366, #326 - others may be fixed as well.
  • This PR is related to issue:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated to README

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError: "clientid"

1 participant