I’m working on auto-archiver which is written in Python.

Currently the cloud storage used is Digital Ocean Spaces. I’m putting in a feature flag to use Google Drive instead.

Secrets are held in the .env file

They use Google Speadsheets already in the application which necessitates Google Drive API access . See 1. Getting API access to the sheet

Google Drive using Service Account

https://developers.google.com/drive/api/quickstart/python

https://blog.benjames.io/2020/09/13/authorise-your-python-google-drive-api-the-easy-way/

alt text

Share a folder with the service account eg autoarchiverservice@auto-archiver-xxxxx.iam.gserviceaccount.com

This allows me to read and write to the shared folder on the google drive account (in the is case it is my personal google drive) from the service account.

ie I can see a shared folder_id I can then write inside that folder.

Code

https://developers.google.com/drive/api/guides/manage-uploads

https://github.com/googleworkspace/python-samples/blob/master/drive/quickstart/quickstart.py Samples

Uploading a file

https://github.com/iterative/PyDrive2 - could use this.

https://developers.google.com/drive/api/guides/search-files API docs

https://github.com/googleworkspace/python-samples/tree/master/drive/driveapp

Appendix - Google Console

https://console.cloud.google.com/ - where you allow access

https://admin.google.com/ is used for Google Workspace accounts only

Appendix - Google Drive Desktop

Using Google Drive Desktop you can view all your files as a linked drive G: in Windows Explorer.

.