Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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"
}
like image 589
codingJoe Avatar asked May 23 '12 02:05

codingJoe


1 Answers

Just a self-plug:

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

like image 98
Yevhen Kuzmovych Avatar answered Sep 24 '22 07:09

Yevhen Kuzmovych