



When I run this code, I receive the following: 1quyzYHc0uCQIEt88gqd4h_jWtlBaoHHH Update_permission(drive_service, file_id, permission_id, 'reader', 'anyone') # # get information needed to update permissions Return service.permissions().update(fileId=file_id, permissionId=permission_id, body=permission).execute()įlow = client.flow_from_clientsecrets('credentials.json', SCOPES)ĭrive_service = build('drive', 'v3', http=thorize(Http()))įile = drive_service.files().create(body=file_metadata,įields='id, webViewLink, permissions').execute() Permission = service.permissions().get(fileId=file_id, permissionId=permission_id).execute() # First retrieve the permission from the API. The updated permission if successful, None otherwise. New_role: The value 'owner', 'writer' or 'reader'. Permission_id: ID of the permission to update. It requires a text file named "testing.txt" to be in the same directory as the script: from googleapiclient.discovery import buildįrom oauth2client import file, client, toolsįrom apiclient.http import MediaFileUploadĭef update_permission(service, file_id, permission_id, new_role, type):įile_id: ID of the file to update permission for. I'm close, but can't quite figure it out! Observe my code. I'm trying to use the Google Drive API v3 with Python 3 to automatically upload files, make them 'public' and get a shareable link that anybody, whether logged into a Google Account or not, can view and download (but not modify).
