2

Does anyone have any example or documentation how to connect a Service Account from Google Drive API with pydrive. I managed to do it with auth2 client.

vinzee
  • 17,022
  • 14
  • 42
  • 60
Luca Vlad
  • 55
  • 7

1 Answers1

3

Apparently this should work, but it does not:

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from oauth2client.service_account import ServiceAccountCredentials

gauth = GoogleAuth()
scope = ["https://www.googleapis.com/auth/drive"]
gauth.credentials = ServiceAccountCredentials.from_json_keyfile_name(JSON_FILE, scope)
drive = GoogleDrive(gauth)

UPDATE: error was caused by some missing permissions in google IAM.

glasz
  • 2,479
  • 24
  • 23
Luca Vlad
  • 55
  • 7