Python google.oauth2';响应中没有访问令牌';尝试打开电子表格时出错

Python google.oauth2';响应中没有访问令牌';尝试打开电子表格时出错,python,oauth-2.0,gspread,Python,Oauth 2.0,Gspread,我试图通过gspread打开google电子表格,但我的代码失败,出现错误: Traceback (most recent call last): File "/home/memcpy/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 156, in jwt_grant access_token = response_data["access_token"] K

我试图通过gspread打开google电子表格,但我的代码失败,出现错误:

Traceback (most recent call last):
  File "/home/memcpy/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 156, in jwt_grant
    access_token = response_data["access_token"]
KeyError: 'access_token'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "email_sender.py", line 20, in <module>
    fetch_users()
  File "email_sender.py", line 16, in fetch_users
    sheet = client.open('some')

  some more tracebacks....

  File "/home/memcpy/.local/lib/python3.6/site-packages/google/auth/transport/requests.py", line 444, in request
    self.credentials.before_request(auth_request, method, url, request_headers)
  File "/home/memcpy/.local/lib/python3.6/site-packages/google/auth/credentials.py", line 133, in before_request
    self.refresh(request)
  File "/home/memcpy/.local/lib/python3.6/site-packages/google/oauth2/service_account.py", line 359, in refresh
    access_token, expiry, _ = _client.jwt_grant(request, self._token_uri, assertion)
  File "/home/memcpy/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 159, in jwt_grant
    six.raise_from(new_exc, caught_exc)
  File "<string>", line 3, in raise_from
google.auth.exceptions.RefreshError: ('No access token in response.', {'id_token': 'there was some token so I hided it'})

我遵循了以下链接的教程:

确保范围变量正确定义为:
范围=[”https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive“]

我遵循了链接到此处的本教程:

确保范围变量正确定义为:
范围=[”https://spreadsheets.google.com/feeds",'https://www.googleapis.com/auth/spreadsheets',"https://www.googleapis.com/auth/drive.file","https://www.googleapis.com/auth/drive“]

在您的情况下,当电子表格ID像
sheet=client那样使用时。按_键(“####”)打开
,您将检索什么结果?您找到解决方案了吗?在您的案例中,当使用电子表格ID如
sheet=client.open_by_key(“###”)
,您将检索什么结果?您找到解决方案了吗??
import gspread
from google.oauth2.service_account import Credentials

scope = [
    'https://googleapis.com/auth/drive',
    'https://googleapis.com/auth/spreadsheets'
]

creds = Credentials.from_service_account_file('creds.json', scopes=scope)
client = gspread.authorize(creds)
sheet = client.open('some')