Get all contacts from Google Contacts API version 3.0

I am trying to recover all contacts from my Gmail account. At the moment, it only seems randomly about 25 (I have about 200 contacts in the "My Contacts" group). I noticed that these contacts that are being extracted are old contacts that I made a long time ago. New contacts are not displayed.

OAuth2Token

token = gdata.gauth.OAuth2Token(client_id=CLIENT_ID, client_secret=CLIENT_SECRET, scope=SCOPE, user_agent=USER_AGENT)
redirect_url = token.generate_authorize_url(redirect_uri=REDIRECT_URI)

Redirection for Auth

self.redirect(redirect_url)

Auth, Get Contacts and Mapping

url = atom.http_core.Uri.parse_uri(self.request.uri)
if 'error' in url.query:
  pass
else:
  token.get_access_token(url.query)

  gd_client = gdata.contacts.client.ContactsClient()
  token.authorize(gd_client)
  feed = gd_client.GetContacts()

for i, entry in enumerate(feed.entry):
  self.response.write(entry.name.full_name)

The developer’s contact page, in the "Sample Code Execution" section, says:

gd_client = gdata.contacts.data.ContactsClient (source = 'YOUR_APPLICATION_NAME')

But it continues to cause an error that ContactClient was not found. I finally found him in gdata.contacts.client.


- USER_AGENT '', ?

+4
1

Source: https://habr.com/ru/post/1545956/


All Articles