views:

239

answers:

1

I'm having some issues trying to pull a shared contact using the gdata api for python that Google provides. Here is what I have to get the contacts.. but they are not all listed there

feed = gd_client.GetContactsFeed()
for i, entry in enumerate(feed.entry):
    print entry.title

I can't figure out how to pull out a single contact so I can edit the contact information..

thanks!

+2  A: 

Google API lacks of features here.
You need to query all your contacts and then iter on them like this:

feedquery = gdata.contacts.service.ContactsQuery()
feedquery.query.max_results = 1000
gmlf = gd_client.GetContactsFeed(feedquery.ToUri())
for index,gmc in enumerate(gmlf.entry):
        print str(index) +":"+ gmc .title.text

Remember to set query.max_results to your needs because by default is set to 25 contacts max; this is probably the reason because they are not all listed after your query.
You can't retrieve one specific contact; you need to retrieve all and filter them using their email or title.

systempuntoout
I am using the v3.0 protocol.GAE raise this:AttributeError: 'ContactsQuery' object has no attribute 'query'the line should change to feedquery.max_results = 1000 according to http://code.google.com/apis/contacts/docs/3.0/reference.html#Parameters
schemacs