小编Mat*_*ist的帖子

'ServiceAccountCredentials.from_json_keyfile_name' 相当于远程 json

我正在设置一个程序来帮助用户完成研究论文的笔记,现在我需要client_secret.json将程序文件与程序文件分开以确保其在线安全。如何从 json 获取凭证而不将其作为 python 程序的文件?

scope = ["https://spreadsheets.google.com/feeds","https://www.googleapis.com/auth/drive"]
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
gs = gspread.authorize(creds)
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,有什么方法可以使用 json 响应而不是 client_secret.json 文件更像:

creds = requests.get("json storage").json
Run Code Online (Sandbox Code Playgroud)

python json google-authentication python-requests gspread

5
推荐指数
1
解决办法
2439
查看次数