Giter Site home page Giter Site logo

icloudpy's People

Contributors

adambenali avatar crissnb avatar leafnsand avatar luqasn avatar mandarons avatar reekenx avatar stanislav-krainikov-unikie avatar tymmej avatar zhouyi619 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

icloudpy's Issues

[BUG] Can not sync special `Favorites` folder

Describe the bug
I set up icloud-drive-docker to sync my Favorites to my disk, but it sees no photos in there even though there should be 4000 of them. It downloads exactly 0 photos.

To Reproduce
Steps to reproduce the behavior:

  1. Use the referenced config for icloud-drive-docker to sync Favorites

Expected behavior
Favorites folder with 4k photos is synced.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration

photos:
  destination: "photos"
  remove_obsolete: false
  sync_interval: 500
  filters: # Optional, use it only if you want to download specific albums. Else, all photos are downloaded to `all` folder.
    albums:
      - Favorites
    file_sizes: # valid values are original, medium and/or thumb
      - "original"
    extensions: #Optional, media extensions to be included in syncing iCloud Photos content
      # - jpg
      # - heic
      # - png

Additional context
I debugged this a bit and it seems that there is a special loop in photos.py that inserts the special folders. But for some reason, icloudpy also sees a Favorites folder in the later loop for "regular" albums, so the special album reference gets overridden.
I patched my local photos.py to give precedence to special folders by looping over them last and that fixes the issue for me.

Please not that if I log in to icloud.com, I do not see a Favorites folder other than the built-in one. I have no idea why it is seen as a regular folder.

Fetching calendars fails due to datetime bug

Call api.calendar.events() fails with:

Traceback (most recent call last):
  File "/home/i/test.py", line 42, in <module>
    my_events = api.calendar.events()
  File "/home/i/.local/lib/python3.10/site-packages/icloudpy/services/calendar.py", line 71, in events
    self.refresh_client(from_dt, to_dt)
  File "/home/i/.local/lib/python3.10/site-packages/icloudpy/services/calendar.py", line 51, in refresh_client
    from_dt = datetime(today.year, today.month, first_day)
ValueError: day is out of range for month

Identical issue to so I assume it's the same pre-existing issue copied from pyicloud to icloudpy.

[BUG] KeyError: 'data_token'

Describe the bug
Failed to download /app/icloud/drive/<path>/<to>/<file>: 'data_token' error for some of .pages documents in drive.
To Reproduce
Steps to reproduce the behavior:
api = ICloudPyService(username.strip(), password.strip())
drive = api.drive
for i in api.drive.dir()
item = drive[i]
if item.type == "file":
localfile = os.path.join('.', item.name)
with item.open(stream=True) as response:
with open(localfile, "wb") as file_out:
copyfileobj(response.raw, file_out)

This produces a KeyError: 'data_token' before this patch when a packaged file like a Pages is attempted to be downloaded.

Expected behavior
File should be downloaded without error.

Screenshots
NA
Configuration
Default configuration.

Additional context
From: mandarons/icloud-docker#11

AttributeError: 'NoneType' object has no attribute 'isatty'

def get_password(username, interactive=stdout.isatty()):

Running this from an app packaged with pyinstaller on Windows raises:

Traceback (most recent call last):
  File "app.py", line 18, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "tuttle\__init__.py", line 10, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "tuttle\calendar.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "icloudpy\__init__.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "icloudpy\base.py", line 21, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "icloudpy\services\__init__.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "icloudpy\services\account.py", line 6, in <module>
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
  File "icloudpy\utils.py", line 12, in <module>
AttributeError: 'NoneType' object has no attribute 'isatty'
```

icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))

I got the following exception when I ran it

Traceback (most recent call last):
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 364, in _authenticate_with_token
    req = self.session.post(
  File "C:\Work\Env\python\Lib\site-packages\requests\sessions.py", line 637, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 158, in request
    self._raise_error(code, reason)
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 187, in _raise_error
    raise api_error
icloudpy.exceptions.ICloudPyAPIResponseException: Missing apple_id field

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Work\pythonProjects\demo\pythonProject\find-my-phone-demo-02.py", line 4, in <module>
    api = ICloudPyService('*****', '******', home_endpoint="https://www.icloud.com.cn",setup_endpoint="https://setup.icloud.com.cn/setup/ws/1",)
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 279, in __init__
    self.authenticate()
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 348, in authenticate
    self._authenticate_with_token()
  File "C:\Work\Env\python\Lib\site-packages\icloudpy\base.py", line 370, in _authenticate_with_token
    raise ICloudPyFailedLoginException(msg, error) from error
icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))

How can I test it to make it work?

Here is my run test code

from icloudpy import ICloudPyService
# api = ICloudPyService('[email protected]', 'password')
# For China region
api = ICloudPyService('13925629668', 'xrf64668', home_endpoint="https://www.icloud.com.cn",setup_endpoint="https://setup.icloud.com.cn/setup/ws/1",)

if __name__ == '__main__':
    print(api)

[FEATURE] Login using App Specific Passwords

Use case
This feature makes a lot of sense for people wanting code to run on a server, but also have some security and not disable 2FA. Apple offers app specific passwords and it's really hard finding a library to support them.

[BUG] Getting errors when trying to delete folder/app_library.

Describe the bug
Getting errors when trying to delete folder/app_library.

To Reproduce

...
drive = api.drive
d = drive.dir()[8]
drive[d].delete()
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\pedro\miniforge3\envs\icloud\Lib\site-packages\icloudpy\services\drive.py", line 342, in delete
    return self.connection.move_items_to_trash(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pedro\miniforge3\envs\icloud\Lib\site-packages\icloudpy\services\drive.py", line 219, in move_items_to_trash
    "clientId": self.params["clientId"],
                ~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'clientId'

Expected behavior
Folder should be deleted.

Screenshots
THe api says that my iPhone is my Airpods Pro 2 instead of my phone or my watch. Is that a problem?
image

[BUG] icloudpy fails to login as a user

Describe the bug
ICloudPyService fails to get login session

To Reproduce
Steps to reproduce the behavior:

  1. run api = ICloudPyService(username, password)
  2. command raises error ("missing apple_id field")

Expected behavior
Command completes successfully

It looks like Apple has changed, perhaps for only some connections, the headers it returns iin response to a login attempt. Thus it fails to get dsWebAuthToken and then _authenticate_with_token fails.

[BUG] JSON files not backup properly

Describe the bug
Syncing json files produce 0B files.

To Reproduce
Add json file to drive and sync

Expected behavior
json files backed up properly

Screenshots
No screenshots, just logs.

2023-08-23 10:12:38,971 :: INFO :: root :: sync_drive.py :: 213 :: Processing /app/icloud/drive/Documents/ArqFileSelections.json
2023-08-23 10:12:38,972 :: DEBUG :: root :: sync_drive.py :: 138 :: Changes detected: local_modified_time is 1671911999, remote_modified_time is 1671911999, local_file_size is 0 and remote_file_size is 4298.
2023-08-23 10:12:38,972 :: INFO :: root :: sync_drive.py :: 188 :: Downloading /app/icloud/drive/Documents/ArqFileSelections.json ...
[...]
2023-08-23 10:12:39,766 :: DEBUG :: urllib3.connectionpool :: connectionpool.py :: 473 :: https://cvws.icloud-content.com:443 "GET [...] HTTP/1.1" 200 4298

Configuration
Not applicable

Additional context
Add any other context about the problem here.

[FEATURE] AsyncIO-based service class - ICloudPyAsync

Use case
As an iCloud user who has several gigs of data, I want to download all of my data and keep it in sync locally faster so that I can be more productive.

Describe the solution you'd like
Currently, this library performs sequential downloading of iCloud data. This is a huge performance bottleneck especially for media and documents (e.g. https://github.com/mandarons/icloud-drive-docker). Downloading from iCloud servers is inherently IO-bound. Using AsyncIO should significantly boost download performance.

Describe alternatives you've considered
Alternative can be multithreading. However, it is not optimal as IO-bound operations will continue to throttle all threads.

Additional context
Some relevant info: https://medium.com/radix-ai-blog/performant-http-with-aiohttp-in-python-3-756580e54eff

[FEATURE] Enable support for shared folders in iCloud drive

Use case
As a user, I want to download iCloud shared folders so that I can always have backup of shared folders as well.

Describe the solution you'd like
The app should download shared folders (folders shared by the user and another user) as if they are regular folders.

Describe alternatives you've considered
None available.

Additional context
Apple introduced Shared Folders feature in iCloud Drive.

[BUG] Cannot import on python 3.10

Describe the bug
Import failed due to very old version of keyring specified in requirements.txt.
What disrupts upgrading it?

To Reproduce

  • from icloudpy import ICloudPyService

Expected behavior
Correctly imported.

Logs

ImportError                               Traceback (most recent call last)
/workspaces/iCloud_drive_uploader/test.ipynb Cell 3' in <cell line: 2>()
      [1] import sys
----> [2] from icloudpy import ICloudPyService
      [3] api = ICloudPyService(os.getenv('icu'), os.getenv('icp'))
      [4] if api.requires_2fa:

File ~/.local/lib/python3.10/site-packages/icloudpy/__init__.py:3, in <module>
      1 """The iCloudPy library."""
      2 import logging
----> 3 from icloudpy.base import ICloudPyService
      5 logging.getLogger(__name__).addHandler(logging.NullHandler())

File ~/.local/lib/python3.10/site-packages/icloudpy/base.py:20, in <module>
     12 import getpass
     14 from icloudpy.exceptions import (
     15     ICloudPyFailedLoginException,
     16     ICloudPyAPIResponseException,
     17     ICloudPy2SARequiredException,
     18     ICloudPyServiceNotActivatedException,
     19 )
---> 20 from icloudpy.services import (
     21     FindMyiPhoneServiceManager,
     22     CalendarService,
     23     UbiquityService,
     24     ContactsService,
     25     RemindersService,
     26     PhotosService,
     27     AccountService,
     28     DriveService,
     29 )
     30 from icloudpy.utils import get_password_from_keyring
     33 LOGGER = logging.getLogger(__name__)

File ~/.local/lib/python3.10/site-packages/icloudpy/services/__init__.py:8, in <module>
      6 from icloudpy.services.reminders import RemindersService
      7 from icloudpy.services.photos import PhotosService
----> 8 from icloudpy.services.account import AccountService
      9 from icloudpy.services.drive import DriveService

File ~/.local/lib/python3.10/site-packages/icloudpy/services/account.py:6, in <module>
      3 from six import PY2, python_2_unicode_compatible
      4 from collections import OrderedDict
----> 6 from icloudpy.utils import underscore_to_camelcase
      9 class AccountService(object):
     10     """The 'Account' iCloud service."""

File ~/.local/lib/python3.10/site-packages/icloudpy/utils.py:3, in <module>
      1 """Utils."""
      2 import getpass
----> 3 import keyring
      4 from sys import stdout
      6 from .exceptions import ICloudPyNoStoredPasswordAvailableException

File ~/.local/lib/python3.10/site-packages/keyring/__init__.py:6, in <module>
      3 import logging
      4 logger = logging.getLogger('keyring')
----> 6 from .core import (set_keyring, get_keyring, set_password, get_password,
      7                   delete_password)
      8 from .getpassbackend import get_password as get_pass_get_password
     10 try:

File ~/.local/lib/python3.10/site-packages/keyring/core.py:14, in <module>
     11 from .py33compat import max
     13 from . import logger
---> 14 from . import backend
     15 from .util import platform_ as platform
     16 from .util import once

File ~/.local/lib/python3.10/site-packages/keyring/backend.py:18, in <module>
     16 from . import errors, util
     17 from . import backends
---> 18 from .util import properties
     19 from .py27compat import add_metaclass, filter
     22 log = logging.getLogger(__name__)

File ~/.local/lib/python3.10/site-packages/keyring/util/properties.py:1, in <module>
----> 1 from collections import Callable
      3 class ClassProperty(property):
      4     """
      5     An implementation of a property callable on a class. Used to decorate a
      6     classmethod but to then treat it like a property.
   (...)
     19     False
     20     """

ImportError: cannot import name 'Callable' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)

[BUG] ICloudPyAPIResponseException from China account.

When do authentication using:

sudo docker exec -it iCloud /bin/sh -c "icloud [email protected] --region=china --session-directory=/app/session_data"
Enter iCloud password for [email protected]:
Save password in keyring? [y/N]: y

Two-step authentication required.
Please enter validation code
(string) -->

The docker container crashed with the following errors:

Loading config from /app/config.yaml ...
2023-03-18 16:07:15,413 :: ERROR :: icloudpy.base :: base.py :: 186 :: Authentication required for Account. (421)
2023-03-18 16:07:15,735 :: ERROR :: icloudpy.base :: base.py :: 186 :: Not Found (404)
Traceback (most recent call last):
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 336, in authenticate
    self.session.post(
  File "/app/venv/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 131, in request
    self._raise_error(response.status_code, response.reason)
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 187, in _raise_error
    raise api_error
icloudpy.exceptions.ICloudPyAPIResponseException: Not Found (404)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/./src/main.py", line 7, in <module>
    sync.sync()
  File "/app/src/sync.py", line 68, in sync
    api = get_api_instance(
  File "/app/src/sync.py", line 30, in get_api_instance
    ICloudPyService(
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 277, in __init__
    self.authenticate()
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 344, in authenticate
    raise ICloudPyFailedLoginException(msg, error) from error
icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid email/password combination.', ICloudPyAPIResponseException('Not Found (404)'))

My account/password is correct, and i received the 2FA. But it crashed when i want to enter validation code.

[FEATURE] Directory size

Use case
Get the size of a particular directory on iCloud drive or get the full storage size of iCloud drive.

Describe the solution you'd like
Useful when running functions where every file/folder is being evaluated for a sync so that overall progress can be reported.

Describe alternatives you've considered
None

Additional context
Add any other context or screenshots about the feature request here.

[ENHANCEMENT] Fix Lint errors for improved code quality

Describe the bug
Lint is failing - fix it for improved code quality.

To Reproduce
Steps to reproduce the behavior:

  1. Run run-ci.sh
  2. See lint errors

Expected behavior
No failure during lint step. Code quality is 10/10.

Screenshots
If applicable, add screenshots to help explain your problem.

Configuration
If applicable, please share the configuration details

Additional context
Add any other context about the problem here.

Update content of icloud file

I'm looking for the best practice to update the content of a file using icloudpy. Currently, my approach involves deleting the file from iCloud and then uploading its updated version with the same name. However, this method isn't always effective as sometimes the file fails to delete from iCloud. When this happens, the new file is uploaded with an index number appended to its name.

Has anyone else encountered this issue and found a solution?

[BUG] api.files.dir() returns KeyError: 'dsid'

Describe the bug
Calling api.files.dir() returns KeyError: 'dsid'

To Reproduce
api = ICloudPyService('########', '########')
....2FA extra work....
api.files.dir()

Expected behavior
Return ubiquity files list

Console output
File "/Users/cyber/Desktop/development/icloudpy/test_ubiquity", line 64, in
for i in api.files.dir():
File "/Users/cyber/Desktop/development/icloudpy/icloudpy/services/ubiquity.py", line 44, in getattr
return getattr(self.root, attr)
File "/Users/cyber/Desktop/development/icloudpy/icloudpy/services/ubiquity.py", line 21, in root
self._root = self.get_node(0)
File "/Users/cyber/Desktop/development/icloudpy/icloudpy/services/ubiquity.py", line 30, in get_node
request = self.session.get(self.get_node_url(node_id))
File "/Users/cyber/Desktop/development/icloudpy/icloudpy/services/ubiquity.py", line 26, in get_node_url
return self._node_url % (self.params["dsid"], variant, node_id)
KeyError: 'dsid'
python-BaseException

Process finished with exit code 1

Additional context
The same problem also occurs on the https://github.com/picklepete/pyicloud project.
In case it's a bug, do you have any plans to fix it for icloudpy?
Thanks you for your support :)

[BUG] ICloudPyFailedLoginException: 'Missing apple_id field'

Describe the bug

Previously successful login code now fails with icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field')):

  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/icloudpy/base.py", line 277, in __init__
    self.authenticate()
    │    └ <function ICloudPyService.authenticate at 0x1189cf2e0><iCloud API: [email protected]>
  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/icloudpy/base.py", line 346, in authenticate
    self._authenticate_with_token()
    │    └ <function ICloudPyService._authenticate_with_token at 0x1189cf370><iCloud API: [email protected]>
  File "/Users/cls/miniforge3/envs/tuttle/lib/python3.10/site-packages/icloudpy/base.py", line 368, in _authenticate_with_token
    raise ICloudPyFailedLoginException(msg, error) from error
          │                            └ 'Invalid authentication token.'<class 'icloudpy.exceptions.ICloudPyFailedLoginException'>

icloudpy.exceptions.ICloudPyFailedLoginException: ('Invalid authentication token.', ICloudPyAPIResponseException('Missing apple_id field'))

To Reproduce
Steps to reproduce the behavior: Run this code snippet

        icloud_connector = icloudpy.ICloudPyService(
            apple_id=apple_id,
            password=password,
        )

Expected behavior

iCloud login.

Configuration

icloudpy 0.3.2

[FEATURE] Enable support for Shared Photo Library

Use case
As a iCloud photos user, I want to download photos from shared library so that I can have the local backup.

Describe the solution you'd like
The library should download photos from shared library as if it is a regular library.

Describe alternatives you've considered
None available.

Additional context
Apple introduced shared photo libraries.

[FEATURE] Support for Advanced Data Protection (iCloud Encryption)

Use case
Now that Apple has rolled out Advanced Data protection globally it's only a matter of time before the masses adopt it and it has potential to be enabled by default for new iCloud accounts soon enough, it would be great to get this project compatible with ADP for people already using it and those who will start to use it in future.

Describe the solution you'd like
Being able to download iCloud photos that are end to end encrypted.

Describe alternatives you've considered
Disabling ADP, but this is less desirable as it's a long overdue feature from Apple

Additional context
If you have ADP enabled on your iCloud account, this is what happens after authenticating (with 2FA) with this project:

Loading config from /app/config.yaml ...
Loading config from /app/config.yaml ...
2023-02-04 14:51:49,566 :: INFO :: root :: sync.py :: 71 :: Syncing drive...
2023-02-04 14:51:50,125 :: ERROR :: icloudpy.base :: base.py :: 186 :: Missing PCS cookies from the request (423)
Traceback (most recent call last):
  File "/app/./src/main.py", line 7, in <module>
    sync.sync()
  File "/app/src/sync.py", line 72, in sync
    sync_drive.sync_drive(config=config, drive=api.drive)
  File "/app/src/sync_drive.py", line 304, in sync_drive
    items=drive.dir(),
  File "/app/venv/lib/python3.10/site-packages/icloudpy/services/drive.py", line 234, in __getattr__
    return getattr(self.root, attr)
  File "/app/venv/lib/python3.10/site-packages/icloudpy/services/drive.py", line 229, in root
    self, self.get_node_data("FOLDER::com.apple.CloudDocs::root")
  File "/app/venv/lib/python3.10/site-packages/icloudpy/services/drive.py", line 34, in get_node_data
    request = self.session.post(
  File "/app/venv/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 158, in request
    self._raise_error(code, reason)
  File "/app/venv/lib/python3.10/site-packages/icloudpy/base.py", line 187, in _raise_error
    raise api_error
icloudpy.exceptions.ICloudPyAPIResponseException: Missing PCS cookies from the request (423)

[BUG] Reminders Lists are not Current

Describe the bug
I wrote a small script to pull my current reminders lists for testing, but it came back with some lists that I deleted a long time ago (When I was in college about 2 years ago) and didn't show any of my current lists.

To Reproduce
Steps to reproduce the behavior:

from icloudpy import ICloudPyService
from icloudpy.exceptions import ICloudPyFailedLoginException

def list_icloud_reminder_lists():
    try:
        # Authenticate with iCloud
        api = ICloudPyService('[email protected]', 'Password')
        if api.requires_2fa:
            code = input("Enter the 2FA code: ")
            api.validate_2fa_code(code)

        # Refresh reminders data to ensure it's up-to-date
        api.reminders.refresh()

        # List all available reminder lists
        print("Available reminder lists:")
        for list_name in api.reminders.lists:
            print(f" - {list_name}")

    except ICloudPyFailedLoginException as e:
        print(f"Login failed: {e}")

if __name__ == "__main__":
    list_icloud_reminder_lists()

After running, I get this result

Available reminder lists:
 - DMACC
 - School

Expected behavior
The current lists in my Reminders app are:

  • All
  • Home
  • Guitar
  • Shopping

Screenshots
image
remindersapp

Configuration
N/A - I don't think?

Additional context
So, my goal with this script is to sync my Amazon Shopping list from my Echo devices, to my iOS Reminders app for easier use. This used to be accomplished by IFTTT, but both Amazon and Apple have moved away from IFTTT. I'm hoping to create a better solution to run periodically on my Raspberry Pi. I tried the pyicloud library first, only to realize that it is way out of date and isn't being maintained. Hoping that this active library can assist better.

[BUG] Authentication required for Account. (421)

Describe the bug
I make an ICloudPyService instance and try to access any API then it prints out the error.

To Reproduce

  1. Make an ICloudPyService instance
  2. run api.drive.dir()

Edit 1:
Expected Behaviour
The program returns a list containing all the folders that are present on iCloud root

Screenshots
Not applicable I think (correct me if im wrong), would just paste in the error, but it's already in the title.

Configuration
I'm not sure about this one, but here are my versions if that's what is asked:
Windows: 64 Bit, 21H2
Python: 3.9.12
ICloudPy: 0.3.3

Additional context
No additional context.

[FEATURE] support for hidden folder

Use case
As a user, I want to download iCloud hidden folder so that I can always have backup of my private pictures

Describe the solution you'd like
The app should download the hidden folder

Describe alternatives you've considered
None available.

Additional context
Apple introduced hidden folder feature in iCloud Drive.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.