Skip to content
Advertisement

Looking for a better python Google Calendar API example

I am trying to write an application that can add events to a google calendar.
There is this really neat site that lets you play with the API. http://code.google.com/apis/explorer/#_s=calendar&_v=v3&_m=events.insert

Using that site, I was able to build a calendar event using the following stuff. I am having difficulty translating that into python. Assuming that I’ve already authenticated with oauth, How do I do this with python code? It looks I have to build a json string and somehow turn that into an http request. I have no clue how to do that.

Can anyone provide an example of how to accomplish the same thing with the Python API?

Many Thanks!

POST
https://www.googleapis.com/calendar/v3/calendars/my_calendar_id_string/events?pp=1&key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.ANOTHERBIGSLONGTRINGHEREFfxCTiKMIR_bDui
X-JavaScript-User-Agent:  Google APIs Explorer

{
"start": {
"dateTime": "2012-05-24T14:00:00-06:00"
},
"end": {
"dateTime": "2012-05-24T18:00:00-06:00"
},
"description": "My Description"
}

Advertisement

Answer

Check the docs for all Python samples, for instance here is one showing how to create an event: https://developers.google.com/google-apps/calendar/v3/reference/events/insert

Advertisement