Looking for a better python Google Calendar API example

Question:

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"
}
Asked By: codingJoe

||

Answers:

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

Answered By: Claudio Cherubino

Came across this article shows with ample screenshots.

Also, this GitHub repo has ample examples.

Answered By: whatf

Just a self-plug:

There is the Google Calendar Simple API (gcsa) for Python (developed by me). It is much simpler, more Pythonic, and object-oriented. It handles credentials, JSON formatting, datetimes/timezones, recurrence, etc. for you. Here is the Documentation.

Answered By: Yevhen Kuzmovych
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.