Create a gist now

Instantly share code, notes, and snippets.

Pull data from Google Contacts
"""Module for pulling contacts out of Google and storing them to disk
(or something).
See the official guide for a more in-depth look at GData Python
import atom
import gdata.contacts
import gdata.contacts.service
import getpass
import sys
def printFeed(feed):
for entry in feed.entry:
nick = ""
name = entry.title.text
for email in
print('%s\t%s\t"%s" <%s>' % (nick, name, name, email.address))
def main(args):
def usage():
print("""usage: <email>
if len(args) < 1:
gd_client = gdata.contacts.service.ContactsService() = args[0]
gd_client.password = getpass.getpass()
gd_client.source = ""
query = gdata.contacts.service.ContactsQuery()
query.max_results = 1000
contacts = gd_client.GetContactsFeed(query.ToUri())
if __name__ == "__main__":
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment