我有一个python模块userbot来管理文件夹文件。https:/github.comadekmaulanaProjectBishblobmasteruserbotmodulesgoogle_drive.py。 从telegram和它运行在heroku。然而在函数 generate_credentials()
在用户完成认证后,用户需要将他们的token放到heroku变量中,以便下次运行,这对用户来说有点不友好,因为有些用户不知道这有多重要。\n
我想把凭证保存到Pickle中,就像google api drive v3文档中说的那样,然后把它存储到数据库中,从而使用户更加友好,但我一开始就迷茫了,我试着把解码后的凭证放到字符串中,然后把它保存到sqlalchemy数据库中,但当我加载它时,它给我带来了奇怪的错误。credentials
认为它运行在云控制台谷歌吗??它说。raise exceptions.DefaultCredentialsError(__HELP_MESSAGE)
google.auth.exceptions.DefaultCredentialsError: could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started
任何建议,使更多的用户友好 将是非常感激,谢谢... ...
更新了。所以问题在于我从数据库中调出的证书在我调用build('drive', 'v3')后没有得到。
通过使用固定 credentials = Column(Text, nullable=False)
在此修复之前,我使用 credentials = Column(String)
要么 String
或 Text
都是一样的,我都试过了,唯一使 creds
是空的,是因为我没有使用 nullable=False
之前。