我有一个python脚本,可以使用gspread从Google Spreedsheet获取信息。
scope = ['https://spreadsheets.google.com/feeds']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread.authorize(creds)
sheet_programar = client.open("FILE").worksheet("SHEET")
# Extract and print all of the values
list_of_hashes = sheet_programar.get_all_records()
这是正在运行的脚本的一部分,但gspread部分仅在白天的几个部分运行。
这一切都有效,但是如果我尝试在另一个脚本上使用相同的凭据来访问同一个工作表,我会收到一个我没有权限的错误。
我对该问题的理解是第一个脚本没有关闭连接,因此我无法使用相同的凭据登录。
我无法找到关于如何关闭它的任何信息?