hi, I have some code that allows me to dump contacts details for a
user-provided contact name. This is written in Python. The problem
is that even when I put in a known contact name, the script returns
None for the birthday. Can anyone see what's wrong with this code?
Is the birthday attribute of an entry supposed to be readable with
just "contact.birthday"?
def getByName(self):
name = raw_input('Name to search? ')
query = gdata.contacts.service.ContactsQuery()
query.max_results = 2000
feed = self.gd_client.GetContactsFeed(query.ToUri())
#roll through all the contacts
for i, entry in enumerate(feed.entry):
nameStr = '%s' % entry.title.text
emailAddie = "<none>"
#when we find a matching contact, spit out it's email address,
organization info and birthday
if nameStr == name:
for email in entry.email:
if email.primary == 'true':
emailAddie = email.address
break
print ( '%s\t%s' % (entry.title.text, emailAddie))
if entry.organization:
print entry.organization.org_title.text + "\t" +
entry.organization.org_name.text
if entry.birthday:
print entry.birthday
return
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---