我正在尝试使用Python上传文件到Google Drive,并从Google Cloud上驱动API。但是,它的凭据在某个时候到期。该怎么办?
我正在使用Python将文件上传到我的Google Drive,这只是一个简单的脚本。有时候它可以正常工作,但是有时我产生的凭据过期。在那里,我可以使这些凭证不终生过期。我还看了一些YouTube视频,他们建议使用刷新令牌。但是我不知道如何在脚本中生成和使用它们。
I am using python to upload files to my google drive, just a simple script. It works fine for sometimes but after sometimes the credentials which I generated expires. Is there as way I can make those credentials not to expire for life time. I also looked on to some YouTube videos who were suggesting something called refresh token. But I don't know how to generate and use them in my script.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我要假设有时意味着7天。
这是因为如
去Google可以安置您的项目。在OUATH2同意屏幕下,将您的项目设置为生产。您的刷新令牌将停止到期。
I am going to assume that sometime means seven days.
This is because as stated in oauth2#expiration
Go to google could console for your project. Under the Ouath2 consent screen and set your project to production. Your refresh tokens will stop expiring.