Backup Google Calendar programmatically: http://www.google.com/reader/subscriptions/export

Posted by Michael on Stack Overflow See other posts from Stack Overflow or by Michael
Published on 2010-03-26T14:36:30Z Indexed on 2010/03/26 14:43 UTC
Read the original article Hit count: 431

Filed under:
|
|
|

I'm struggling with writing a python script that automatically grabs the zip fail containing all my google calendars and stores it (as a backup) on my harddisk.

I'm using ClientLogin to get an authentication token (and successfully can obtain the token).

Unfortunately, i'm unable to retrieve the file at https://www.google.com/calendar/exporticalzip

It always asks me for the login credentials again by returning a login page as html (instead of the zip).

Here's the critical code:

post_data = post_data = urllib.urlencode({ 'auth': token, 'continue': zip_url})
request = urllib2.Request('https://www.google.com/calendar', post_data, header)
try:
  f = urllib2.urlopen(request)
  result = f.read()
except:
  print "Error"

Anyone any ideas or done that before? Or an alternative idea how to backup all my calendars (automatically!)

© Stack Overflow or respective owner

Related posts about google

Related posts about calendar