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

410 errors periodically stopping the backup #6

Open
cjenow opened this issue Dec 6, 2024 · 1 comment
Open

410 errors periodically stopping the backup #6

cjenow opened this issue Dec 6, 2024 · 1 comment

Comments

@cjenow
Copy link
Contributor

cjenow commented Dec 6, 2024

After about 2000 successful photo downloads, I'm getting a 410 error upon each and every file download/write attempt. I was able to get the backup to continue by simply re-running the script, but this involved a very long delay of enumerating all ~34,000 of my photos again.

I'm locally testing a change that, upon a 410 error, automatically re-auths & re-requests/generates the album object.

I'm curious if anyone knows why the 410 download errors are happening and how best to re-design the script, ideally to not hit them, or at least to be resilient if they occur.

@cjenow
Copy link
Contributor Author

cjenow commented Dec 7, 2024

Hi @pablogzalez - for your info:

  1. I did get the full backup (of about 150 GB of photos and videos) to complete after I added logic to handle the 410 error by re-starting the whole iCloud photos enumeration and backup process--not an ideal or efficient solution, but it worked.
except PyiCloudAPIResponseException as descargar_error:
            print(colored(f"\n🔴 Error al descargar {photo_id_with_filename}: {descargar_error}. Omitiendo...", "red"))
            if "Gone" in str(descargar_error): 
                print(colored(f"\n🔴 Detalles: Error 410 al descargar {photo_id_with_filename}: {descargar_error}. Re-authing, then recursing...", "red"))
                api = authenticate(username, password)  # Re-authenticate
                backup_photos_to_local(api, album_name, dest_directory)
  1. It's appearing to me that the 410 errors (when initially, as with the code in the main branch, not handled by re-starting the backup process) are what initially caused the zero-byte files to be written (because each file write began, creating a zero byte file, but then each download failed, as soon as the 410 errors began; as soon as one 410 error occurred, it would continue occurring for every next photo download attempt too, thus creating many, many zero-byte files.)

image
image

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

No branches or pull requests

1 participant