当前,我一直在使用以下脚本对Google云平台进行身份验证:
gauth = GoogleAuth()
# Try to load saved client credentials
gauth.LoadCredentialsFile("mycreds.txt")
if gauth.credentials is None:
# Authenticate if they're not there
gauth.LocalWebserverAuth()
elif gauth.access_token_expired:
# Refresh them if expired
gauth.Refresh()
else:
# Initialize the saved creds
gauth.Authorize()
# Save the current credentials to a file
gauth.SaveCredentialsFile("mycreds.txt")
drive = GoogleDrive(gauth)
textfile = drive.CreateFile({'title': str(filename_base+xdate+filename_ext)})
# job_titles = [line.decode('utf-8').strip() for line in references]
textfile.SetContentString(str(references))
textfile.Upload()
但是,最近,我不得不从用户的角度隐藏mycreds.txt
文件。文档中没有称为LoadCredentialsString
的方法,所以我的问题是是否可以绕过LoadCredentialsFile
函数作为真正长字符串作为参数传递?
感谢您的答复。