【发布时间】:2021-04-05 01:52:15
【问题描述】:
我想将文件 - Sarcasm_Headlines_Dataset.json 和 glove.6B.300d.txt 从 https://drive.google.com/drive/folders/1s37-DVvRWfOcv59ojc6DnwHzPFkA6e8M 下载到我的驱动器中,以便我可以在 Google 协作中阅读。
在 google collab 中,我尝试了以下方法:
import urllib.request
urllib.request.urlretrieve('https://drive.google.com/drive/folders/1s37-DVvRWfOcv59ojc6DnwHzPFkA6e8M', 'Sarcasm_Headlines_Dataset')
os.listdir()
import pandas as pd
url = 'https://drive.google.com/drive/folders/1s37-DVvRWfOcv59ojc6DnwHzPFkA6e8M'
df = pd.read_json(url, orient='columns')
https://developers.google.com/drive/api/v3/quickstart/python - a) 我将用于项目快速启动的桌面应用程序的客户端 API 下载到我的本地驱动器中。 (凭证.json)。 b) 安装了谷歌客户端库 c) 当我运行 python quickstart.py 时,它说请访问此 URL 以授权此应用程序。我访问了网址并得到了
Error 400: redirect_uri_mismatch; does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/${your_client_id}?project=${your_project_number}
我去了 API 控制台并在 Web 浏览器中获取了客户端 ID 和客户端密码。 再次重新运行 python quickstart.py 并得到相同的错误。
我认为我需要在 google collab 中运行以下代码:
request = service.files().get_media(fileId=file_id)
fh = io.FileIO(location + filename, 'wb')
downloader = MediaIoBaseDownload(fh, request, 1024 * 1024 * 1024)
我无法 file_id。请帮忙。
我希望 json 在 google collab 中运行 LSTM 代码。
【问题讨论】:
标签: python google-apps-script google-drive-api google-oauth google-api-python-client