我正在尝试使用Google电子表格OAuth和gspread库。我在发送凭据时遇到TypeError: expected bytes, not str
异常。我怎么解决这个问题?在
import gspread
import json
from oauth2client.client import SignedJwtAssertionCredentials
json_key = json.load(open('Test for gspread-78c678a7fb15.json'))
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(json_key['client_email'], json_key['private_key'], scope)
gc = gspread.authorize(credentials)
^{pr2}$
密钥是字符串,需要编码为字节。将
credentials =
替换为以下内容:相关问题 更多 >
编程相关推荐