PyDrive backend no longer fully supported
I have:
-
searched https://gitlab.com/duplicity/duplicity/-/issues for similar issues. If you find a similar issue and the issue is still open, add a comment to the existing issue instead of opening a new one. If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one. -
searched https://bugs.launchpad.net/duplicity for similar issues. If you find a similar issue, open a new issue on here and include a link to the original issue in the body of your new one. -
tested that this issue still occurs on the latest stable snap (install instructions: https://snapcraft.io/duplicity), please include the snap version ( snap info duplicity | grep installed) output:installed: x.xx.xx (xx) -
ideally, tested that this issue still occurs on the latest edge snap, if you can test without risking your data. Please include the snap version output: installed: x.xx.xx (xx)
Summary
When using Duplicity with the PyDrive backend to upload files to a standard Google Drive account, the request times out with "Header Missing:". This is caused by unsupported PyDrive dependency httplib2 versions 0.16.0+. Additionally, PyDrive is not actively maintained, instead it is recommended to switch to this newer fork PyDrive2. Therefore, I would like to either pin these dependencies to the old version (working but not a good long term solution) or upgrade duplicity to use PyDrive2 or some other Google Auth API (newer but more time consuming to implement) for Google Drive backups.
Environment
Alpine Linux v3.13.5
duplicity 0.8.13
GNU bash, version 5.1.0(1)-release (x86_64-alpine-linux-musl)
Steps to reproduce
Run a backup to Google Drive using a user account with the PyDrive backend, or by using a docker container like mine here.
What is the current bug behaviour?
The backup will fail if any file is above 5MB and the backup will timeout and fail after 5 attempts.
What is the expected correct behaviour?
Duplicity should be able to complete the backup.
Relevant logs and/or screenshots
The following is the error message produced:
Attempt 1 failed. RedirectMissingLocation: Redirected but the response is missing a Location: header.
After 5 attempts, it gives up and exits.
Possible fixes
The bug is caused by a change in httplib2 versions 0.16.0 and onward, which is a dependency of PyDrive, which is the backend for Duplicity when backing up to Google Drive. The bug involves the unorthodox way that Google Drive API handles 308 interrupts, which httplib2 no longer supports. Check out the following links:
- Google API GitHub page
- Bugzilla post
- This blog post
- This Stack Overflow post about the technical details
The problem can be fixed by following the suggestions on the above GitHub page, and pinning httplib2 to version 0.15.0 and google-api-python-client to version 1.17.11.
A more permanent and efficient solution would be to switch over internally to this newer fork PyDrive2, although I am not sure how difficult this would be to accomplish.