Google People API - Get contact profile picture

Viewed 427

When I try to get the profile photos of my contacts on Google Contacts, I just get the first letter of their name as a picture, not the image that I uploaded as their profile picture.

This is the code I use to get photos (a bit ugly for now):

print('List 10 contacts')
    results = service.people().connections().list(
        resourceName='people/me',
        pageSize=10,
        personFields='names,emailAddresses,photos').execute()
    connections = results.get('connections', [])

    for person in connections:
        names = person.get('names', [])
        photos = person.get('photos', [])
        if names:
            name = names[0].get('displayName')
            photo = photos[0].get('url')
                print(name + ': ' + photo)
0 Answers
Related