Access and download photos from iCloud Photo Library
masterThe iCloud Photo Library is accessed via the api.photos property.
Browsing Photos:
api.photos.all: Access the 'All Photos' album. This album is sorted byadded_date(most recent first).api.photos.albums['AlbumName']: Access specific albums. These are sorted byasset_date(EXIF date).- Iterating over an album yields
PhotoAssetobjects.
Downloading Photos:
- Use
photo.download()to download the original version. This returns arequests.Responseobject withstream=True. Usedownload.raw.read()or a buffered strategy likeshutil.copyfileto save the file. - Versions: Each photo has a
.versionsproperty (e.g.,['medium', 'original', 'thumb']). To download a specific version, pass the version key to the download method:photo.download('thumb').
Photo Metadata:
photo.filename: The filename of the asset.photo.versions[version_key]['filename']: The filename associated with a specific version.