简体   繁体   English

Google 表格 Python 快速入门需要定期登录

[英]Google Sheets Python Quickstart requires sign in regularly

I have set up a script which pulls data from a number of spreadsheets using the Google Sheets API in Python.我设置了一个脚本,该脚本使用 Python 中的 Google 表格 API 从多个电子表格中提取数据。 All works perfectly.一切都完美无缺。 However, I noticed that it requires me to manually sign in to my Google account every now and then.但是,我注意到它需要我不时手动登录我的 Google 帐户。 More precisely, this happens after a custom clean of my PC's temporary files or a cleaning of my browser's cache data.更准确地说,这是在自定义清理我的 PC 的临时文件或清理我的浏览器缓存数据之后发生的。

However, this affects my script being run autonomously.但是,这会影响我的脚本自主运行。 On the other hand, I cannot and shouldn't let cache and other temporary PC files to pile up just because of this single script.另一方面,我不能也不应该因为这个单一的脚本而让缓存和其他临时 PC 文件堆积起来。 Surely, I can manually approve it every time but that just takes away the point of automation, since I'd need to be always around.当然,我每次都可以手动批准它,但这只会带走自动化点,因为我需要一直在身边。

My question is, how can I identify the file where the Python Quickstart application's data is stored and set up an exception to that folder so that Google Chrome, CCleaner and such applications do not remove the data stored within?我的问题是,如何识别 Python Quickstart 应用程序数据存储的文件,并为该文件夹设置一个例外,以便 Google Chrome、CCleaner 和此类应用程序不会删除其中存储的数据?

I use Windows 10.我使用 Windows 10。

Did you check:你检查过了吗:

https://developers.google.com/sheets/api/quickstart/python https://developers.google.com/sheets/api/quickstart/python

Import pickle should be used to store your credentials and you should just confirm the login manually ones.应该使用导入泡菜来存储您的凭据,并且您应该手动确认登录。

The file token.pickle stores the user's access and refresh tokens, and is created automatically when the authorization flow completes for the first time.文件 token.pickle 存储用户的访问和刷新令牌,并在授权流程第一次完成时自动创建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM