开发者

Google Apps shared contacts API get a contact for python

I'm having some issue开发者_高级运维s 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!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜