icloudpy
icloudpy copied to clipboard
[BUG] `ZONE_NOT_FOUND (502)` when calling `get_app_node()` with data retuned by `get_app_data()`
Describe the bug
This code:
https://github.com/mandarons/icloudpy/blob/0b31ddc4094bd942871416e34abb43a225310eca/icloudpy/services/drive.py#L70-L81
Either generates incorrect drivewsid or does not match the drivewsid expected by Apple.com. This results in a traceback like:
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
File "/Users/chris/.pyenv/versions/3.12.2/lib/python3.12/site-packages/icloudpy/services/drive.py", line 81, in get_app_node
return DriveNode(self, self.get_node_data("FOLDER::" + app_id + "::" + folder))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.12.2/lib/python3.12/site-packages/icloudpy/services/drive.py", line 35, in get_node_data
request = self.session.post(
^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.12.2/lib/python3.12/site-packages/requests/sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/chris/.pyenv/versions/3.12.2/lib/python3.12/site-packages/icloudpy/base.py", line 158, in request
self._raise_error(code, reason)
File "/Users/chris/.pyenv/versions/3.12.2/lib/python3.12/site-packages/icloudpy/base.py", line 187, in _raise_error
raise api_error
icloudpy.exceptions.ICloudPyAPIResponseException: ZONE_NOT_FOUND (502)
To Reproduce Code to reproduce the behavior:
for item in api.drive.get_app_data():
try:
print(item['zone'])
print(api.drive.get_app_node(item['zone']))
except:
print("Invalid data from api!")
Expected behavior
Output shows the app node data for all apps:
iCloud.com.apple.iBooks
{type: app_library, name: Books}
F3LWYJ7GM7.com.apple.musicmemos.ideas
{type: app_library, name: Music Memos}
Actual behavior
Output catches incorrect/invalid drivewsids:
com.apple.videoapps.cloudcontent.imovieios.private
Invalid data from api!
iCloud.com.mattermost.rn
Invalid data from api!
com.apple.notes
Invalid data from api!
PB4R74AA4J.com.junecloud.Deliveries
{type: app_library, name: Deliveries}