By r0f1


2019-10-09 13:43:52 8 Comments

My company has several shared Google Drives and each of those are shared among different teams. I want to upload data to one of those drives using a Python script. More precisely, I want to upload to a specific folder in a drive and not to any other location. So the Python script should only have minimal permissions because I don't want my Python script to wreak havoc on the drive.

Is it possible to grant an application permissions on a folder level? If not, what would be the best strategy to tackle the file upload (e.g. a new shared drive, mounting a bucket in google drive)?

I already looked for information here, here, here and other places, but could not find any useful information.

2 comments

@Rafa Guillermo 2019-10-09 14:46:26

Answer:

While it isn't possible to grant permissions to only one folder for a user, it is possible to achieve this with a Service Account, or by restricting the scopes of your script.

Workarounds & Further Information:

Service Accounts aren't the same as users as for as Google API interaction goes, and it is possible to give a Service Account access to a single folder of choice rather than full Drive access. If your script is therefore run by a service account, it is possible to limit the access scope of your script.

Alternatively, the https://www.googleapis.com/auth/drive.file scope gives your application the ability to only manage Google Drive files and folders which have been opened or created by the App itself.

References:

@DaImTo 2019-10-09 14:01:05

Is it possible to grant an application permissions on a folder level?

When an application is granted access to google drive its to the full drive account. Read, write access would be to the full account you cant lock it to a folder

Related Questions

Sponsored Content

12 Answered Questions

[SOLVED] Correct way to write line to file?

  • 2011-05-28 05:44:53
  • Yaroslav Bulatov
  • 1930870 View
  • 966 Score
  • 12 Answer
  • Tags:   python file-io

1 Answered Questions

permission update for a file in google drive

1 Answered Questions

Python: Google Drive Authentification and folder

2 Answered Questions

1 Answered Questions

How to bring a google drive to my web application?

2 Answered Questions

[SOLVED] Can I grant append-only permission to a google drive file?

Sponsored Content