forked from mirror/django-mailbox
Remoing unaccessed 'fetch_contacts' function.
This commit is contained in:
parent
d1485d9cd5
commit
8af7c676fb
1 changed files with 0 additions and 22 deletions
|
|
@ -109,25 +109,3 @@ def fetch_user_info(email):
|
|||
"https://www.googleapis.com/oauth2/v1/userinfo?alt=json"
|
||||
)
|
||||
return result
|
||||
|
||||
|
||||
def fetch_google_contacts(email, limit=10000):
|
||||
result = google_api_get(
|
||||
email,
|
||||
"https://www.google.com/m8/feeds/contacts/default/full"
|
||||
"?v=3.0&alt=json&max-results=%s" % limit
|
||||
)
|
||||
entries = result['feed']['entry']
|
||||
valid_entries = [
|
||||
x for x in entries
|
||||
if u'gd$email' in x.keys() and u'gd$name' in x.keys()
|
||||
]
|
||||
contacts = []
|
||||
for each in valid_entries:
|
||||
try:
|
||||
name = each[u'gd$name'][u'gd$fullName'][u'$t']
|
||||
except KeyError:
|
||||
name = None
|
||||
for each_email in each[u'gd$email']:
|
||||
contacts.append(dict(name=name, email=each_email[u'address']))
|
||||
return contacts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue