Skip to content

gemistass/gdrive-adapter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Upload files to/from google drive

In order to interact with gdrive we need to

  1. Create a project in google cloud platform

  2. Create a service account and a

  3. Add a principal and grant access with a role that has permission, e.g.: Editor role

  4. Enable google Drive Api in our project

  5. Create and place the key into uploadFile.py -> SERVICE_ACCOUNT='...'

  6. Arguments:

    • file: path to the file to be uploaded e.g.: 'resources/kitty.jpg'

    • name: new name of the file when uploaded e.g.: 'hellokaity.jpg'

    • path: path to target folder to be uploaded.There has to be at least one subfolder and the root shared folder must exist and be correct. e.g.: 'parentfolder/targetfolder or Statistics/MENSUEL MONTHLY/2022/01_2022'

Upload file

python3 GoogleDriveAdapter.py resources/kitty.jpg helloKaitty.jpg kittyhome/kittyharem

Use GdriveAdapter

from GoogleDriveAdapter import GdriveAdapter

gdriveAdapter = GdriveAdapter()
gdriveAdapter.createDirectory(path)
gdriveAdapter.uploadFile(file, name, path)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages