2011-03-07 64 views
0

我想在我的聯繫人列表來訪問所有條目的組名組名。如何訪問給定href鏈接的組的詳細信息?獲取使用GDATA API

這是電流輸出:

9 Albert Gandhi 2011-03-07T09:48:19.824Z 
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me. 
    [email protected] 
    Member of group: http://www.google.com/m8/feeds/groups/blah.blah%40blah.com/base/4c8d4c8d8d218d21 

不過,我想是這樣的:

9 Albert Gandhi 2011-03-07T09:48:19.824Z 
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me. 
    [email protected] 
    Member of group: GroupName 

下面是我使用到列表中的聯繫人飼料(主要來自於例子代碼隨API提供)

def PrintFeed(self, feed, ctr=0): 
    """Prints out the contents of a feed to the console. 

    Args: 
     feed: A gdata.contacts.ContactsFeed instance. 
     ctr: [int] The number of entries in this feed previously printed. This 
      allows continuous entry numbers when paging through a feed. 

    Returns: 
     The number of entries printed, including those previously printed as 
     specified in ctr. This is for passing as an argument to ctr on 
     successive calls to this method. 

    """ 
    if not feed.entry: 
     print '\nNo entries in feed.\n' 
     return 0 
    for i, entry in enumerate(feed.entry): 
     print '\n%s %s %s' % (ctr+i+1, entry.title.text, entry.updated.text) 
     if entry.content: 
     print ' %s' % (entry.content.text) 
     for email in entry.email: 
     if email.primary and email.primary == 'true': 
      print ' %s' % (email.address) 
     # Show the contact groups that this contact is a member of. 
     for group in entry.group_membership_info: 
     print ' Member of group: %s' % (group.href) 
     # Display extended properties. 
     for extended_property in entry.extended_property: 
     if extended_property.value: 
      value = extended_property.value 
     else: 
      value = extended_property.GetXmlBlobString() 
     print ' Extended Property %s: %s' % (extended_property.name, value) 
    return len(feed.entry) + ctr 
+0

@gonvaled從從何**「組名」 **我們看到你展示,你想要的,對於結果的字符串「組成員:」? http://www.google.com/m8/feeds/groups/blah.blah%40blah.com/base/4c8d4c8d8d218d21是** ** group.href,據我undesratnd。所以你必須找到將給GroupName的組的屬性。還有什麼 ?? – eyquem 2011-03-07 11:18:14

+0

GroupName只是一個佔位符。應該出現真實的羣組名稱,例如朋友,同事或任何自定義的羣組名稱。問題是我不知道如何從組的href開始訪問這些信息。 – dangonfast 2011-03-07 11:26:20

+0

@gonvaled我們無法知道更多。我試過地址,結果是_Authorization需要錯誤401_看來它是一個私人數據庫或網站。你如何讓人們能夠從私人場所獲得信息? – eyquem 2011-03-07 11:36:11

回答

0

僅供參考,你可以找到解決這個問題的方法here