You are here: home » blog » backup-google-services-data » comment-page-1

What's he up to?

Backup google services data

From Kees van den Broek. August 12, 2009, 1 Comment

Outsourcing as much services as I can to a (free) third party saves a lot of time I would otherwise have spent on system administration. The task that will always remain, is keeping backups.

Install the prerequisites on Ubuntu Jaunty or later:

$ sudo apt-get install python-gdata

Or on any previous Debian based system:

$ sudo apt-get install python-setuptools
$ sudo easy_install gdata

This small script keeps track of Google Contacts and Google Calendar.

#!/usr/bin/env python
 
import gdata.contacts.service
import gdata.calendar.service
import gdata.docs.service
 
accounts = [{"user":"kvdb@kvdb.net", "password":"xxx"}]
max_results = 9999
 
def backupContacts(user, password):
    cs = gdata.contacts.service.ContactsService()
    cs.ClientLogin(user, password)
    query = gdata.contacts.service.ContactsQuery()
    query.max_results = max_results
    feed = cs.GetContactsFeed(query.ToUri())
    f = open(user + "_contacts.xml", 'w')
    f.write(feed.ToString())
    f.close()
 
def backupCalendar(user, password):
    cs = gdata.calendar.service.CalendarService()
    cs.email = user
    cs.password = password
    cs.ProgrammaticLogin()
    feed = cs.GetCalendarEventFeed(uri="/calendar/feeds/default/private/full?max-results=%s" % max_results)
    f = open(user + "_calendars.xml", 'w')
    f.write(feed.ToString())
    f.close()
 
for account in accounts:
        backupContacts(account['user'], account['password'])
        backupCalendar(account['user'], account['password'])

One Response to “Backup google services data”

  1. Rik says:

    Ik heb laatst eens een diepteinvesterinkje gedaan in providers voor agenda/contacten gegevens. Er zijn een paar hele goede. Uiteindelijk heb ik een accountje genomen bij memotoo.com. Deze provider zorgt dat ik al mijn gegevens in allerlei formaten tussen mijn systemen kan uitwisselen. Ook biedt ie een secured linkje waarmee ik iedere nacht al mijn data in een keer kan backuppen. Ik ben er erg tevreden mee en ben blij dat ik BB google achter me kon laten.

    Groet, Rik

Leave a Reply


last modified on 2010-09-06 @ 10:12