2

私は現在、Google カレンダーとやり取りするための単純なネイティブ Python アプリケーションを作成しています。そのために、Google Python ライブラリのおかげで、初めて Google カレンダー API を使用しています。

ただし、ドキュメントにもかかわらず、カレンダーに新しいイベントを挿入することで行き詰まっています。リクエストを接続して実行するためのコードの一部を次に示します。

import sys
...
import httplib2
from apiclient.discovery import build
from oauth2client.file import Storage
from oauth2client.client import AccessTokenRefreshError
from oauth2client.client import flow_from_clientsecrets
from oauth2client.tools import run

...

flow = flow_from_clientsecrets('client_secrets.json',
    scope='https://www.googleapis.com/auth/calendar',
    redirect_uri='http://localhost')

storage = Storage('credentials.dat')
credentials = storage.get()
if credentials is None or credentials.invalid:
  credentials = run(flow, storage)

http = httplib2.Http()
http = credentials.authorize(http)
service = build('calendar', 'v3', http=http)

try:
  event = {
    "start": "2013-02-20T09:00:00.000+01:00",
    "end": "2013-02-20T11:00:00.000+01:00",
    "summary": "New event",
    "location": "Paris, FRANCE"
  }
  service.events().insert(calendarId='primary', body=event).execute()
  print "END"
except AccessTokenRefreshError:
  print ('Credentials have been revoked')

実行すると、それが私が得たものです:

{
 "error": {
  "errors": [
   {
    "domain": "usageLimits",
    "reason": "dailyLimitExceededUnreg",
    "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
    "extendedHelp": "https://code.google.com/apis/console"
   }
  ],
  "code": 403,
  "message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
 }
}

Google Calendar API のリファレンス ドキュメントで見つけたすべてのコード サンプルを含め、これまでに多くのことを試しましたが、何も変わっていません。

よろしくお願いします。

4

1 に答える 1