Python Pydrive аутентификация из строковых учетных данных - PullRequest
0 голосов
/ 04 марта 2019

В настоящее время я использую следующий скрипт для аутентификации на облачной платформе 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, чтобы передать в качестве аргумента действительно длинную строку?

Спасибо за любые ответы.

...