GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - archmaester/gdrive-python: Lets you upload/download files to google drive assuming one has registered on developers.google and has client_secrets.json

BranchesTags
Open more actions menu

Latest commit

 

History

19 Commits
19 Commits

Folders and files

NameName
Last commit message
Last commit date
.gitignore
.gitignore
 
 
README.md
README.md
 
 
drive.py
drive.py
 
 
settings_template.yaml
settings_template.yaml
 
 

Repository files navigation

GoogleDrive Python API

Lets you upload files and folders to google drive assuming one has registered on developers.google and has client_secrets.json

Instructions

  • After downloading the client_secrets.json do
export DRIVE_SECRET_PATH=$FILEPATH_TO_SECRETS.json
  • Rename settings_template.yaml to settings.yaml
  • Copy clientId and clientSecret from client_secrets.json to respective fields in settings.yaml
  • It will ask for one time verification, for subsequent runs, the parameters will be taken from creds.json
  • If you are running on a server where verification on browser is not possible, create a ssh tunnel
ssh -N -L localhost:$MACHINE_PORT_NO:localhost:$SERVER_PORT_NO username@server-ip

Script for uploading a file

python drive.py --upload-file --parent-id $DRIVE_FOLDER_ID --file-name $FILENAME --upload-name $UPLOADNAME --file-path $DIRPATH
  • DRIVE_FOLDER_ID: Id that you will find on the url for the parent-folder where you want to upload a new file
  • FILENAME: name of the file you want to upload
  • DIRPATH: Path to directory where the file is
  • UPLOADNAME: Name of the file that will appear on drive

Script for uploading a folder

python drive.py --upload-folder --parent-id $DRIVE_FOLDER_ID --folder-name $UPLOADNAME --folder-path $FOLDERPATH
  • DRIVE_FOLDER_ID: Id that you will find on the url for the parent-folder where you want to upload a new folder
  • UPLOADNAME: name of the folder to be uploaded that will appear on the drive
  • FOLDERPATH: Path to the folder which you want to upload

Script for downloading a file

python drive.py --download-file --file-id $DRIVE_FILE_ID --file-path $FOLDERPATH
  • DRIVE_FILE_ID: Id of the file to be downloaded
  • FOLDERPATH: Path to the folder where the file is to be saved

References

  • https://medium.com/analytics-vidhya/pydrive-to-download-from-google-drive-to-a-remote-machine-14c2d086e84e
  • https://medium.com/analytics-vidhya/how-to-connect-google-drive-to-python-using-pydrive-9681b2a14f20

Done List

  • ✅ Recursively upload folders and files
  • ✅ Add settings.yaml
  • ✅ No verification for subsequent runs
  • ✅ Upload file
  • ✅ Upload folder
  • ✅ Download file

To Do List

  • ⬜️ Script to list files in a folder
  • ⬜️ Script to update files
  • ⬜️ Script to delete files

About

Lets you upload/download files to google drive assuming one has registered on developers.google and has client_secrets.json

Resources

Readme
Activity

Stars

1 star

Watchers

3 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.