3

I have more of a general question about how I would go about achieving something. I would like to run a daemon process that updates my own Google Calendar (as a background process). I have consulted the sites regarding Google API procedure (authentication, access tokens, etc.) and it seems that the authentication code I've seen requires manual authentication on my part (i.e. me pressing the 'yes, i'm okay with this application accessing my calendar' button). Given that I am writing a program to access my own google calendar (so security shouldn't be an issue), is there any way I can authenticate from within my own source code (perhaps a way of including my login info within the Python script I am writing for this program)?

I hope that makes sense. Thanks for the help!

4

1 回答 1

1

您应该查看使用 OAuth2.0 的服务帐户。(见这里:https ://developers.google.com/accounts/docs/OAuth2#serviceaccount )它将为您的应用程序提供一个服务帐户,您可以从中处理您的应用程序的日历。

我知道使用 java 可以做到这一点,在这里您会找到一个示例,展示如何使用 Java 做到这一点。(https://code.google.com/p/google-api-java-client/wiki/OAuth2#Service_Accounts

而且我几乎可以肯定 Python 也可以。(见https://developers.google.com/accounts/docs/OAuth2ServiceAccount

于 2013-07-19T11:41:14.360 回答