我成功完成了此处的快速入门演示:
https://developers.google.com/drive/api/v3/quickstart/python
我希望更进一步,开始上传文件和文件夹。为此,我将范围替换为: SCOPES = ['https://www.googleapis.com/auth/drive']
我也将执行替换为
national_parks = ['Yellowstone', 'Rocky Mountain', 'Yosemite']
for national_park in national_parks:
file_metadata = {'name': national_park,
'mimeType': 'application/vnd.google-apps.folder'
# 'parents': []
}
service.files().create(body=file_metadata).execute()
Run Code Online (Sandbox Code Playgroud)
然后我收到一个错误: googleapiclient.errors.HttpError: <HttpError 403 when requesting https://www.googleapis.com/drive/v3/files?alt=json returned "Insufficient Permission: Request had invalidauthenticationscopes.">
请帮助
python google-api google-drive-api google-oauth google-api-python-client