0

Is there an easy way to access google drive files loging in with some credentials, somewhat like

GET https://www.googleapis.com/drive/v3/fileid&credentials...
Servus
  • 479
  • 3
  • 13
  • This [link](https://stackoverflow.com/questions/28593022/list-google-drive-files-with-curl) is how to do it with CURL, i do not know if the info there is still valid. – Luuk Jun 27 '20 at 16:05
  • thanks, I will look into it – Servus Jun 27 '20 at 16:07

1 Answers1

0
  1. Create new project on the google cloud platform, enable drive api, create service account for that project and finally get the credentials.json of drive api
  2. (Optionally: create folder on your personal drive and share it with the service accounts email, which is now able to use that folder. This way you can download or edit files manually)
  3. Code:

 from googleapiclient.discovery import build
 from oauth2client.service_account import ServiceAccountCredentials

 credentials = ServiceAccountCredentials.from_json_keyfile_name(
            "myCredentials.json",
            scopes=[
                'https://www.googleapis.com/auth/drive'
            ])
 service = build('drive', 'v3', credentials=credentials)
Servus
  • 479
  • 3
  • 13