小编Vic*_*ruz的帖子

Google API google.auth.exceptions.RefreshError:'invalid_scope:错误请求'

我正在编写一个从 Google 表格中读取数据的小型 Python 程序。到昨天为止,代码一切正常。然而,当我今天尝试运行它时,它不起作用。

# If modifying these scopes, delete the file token.json.
SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly']

# The spreadsheet ID
SPREADSHEET_ID = 'My spreadsheet ID'

def main():

    # Sets the range
    RANGE = 'My range'

    creds = None
    # The file token.json stores the user's access and refresh tokens, and is
    # created automatically when the authorization flow completes for the first
    # time.
    if os.path.exists('token.json'):
        creds = Credentials.from_authorized_user_file('token.json', SCOPES)
    # If there are no (valid) credentials available, let …
Run Code Online (Sandbox Code Playgroud)

python google-api google-sheets

7
推荐指数
1
解决办法
5752
查看次数

标签 统计

google-api ×1

google-sheets ×1

python ×1