How do I use apiclient.discovery.build to get an email address?

783 views
Skip to first unread message

Zak

unread,
Dec 8, 2012, 5:47:47 PM12/8/12
to google-api-p...@googlegroups.com
 I'm trying to return the users email address after authorizing with scope "https://www.googleapis.com/auth/userinfo.email". I've tried the following:

service = build('userinfo', 'v1', http=http)
service = build('userinfo.email', 'v1', http=http)
service = build('email', 'v1', http=http)
service = build('profile', 'v1', http=http)
service = build('profile.email', 'v1', http=http)

 but all I get is UnknownApiNameOrVersion errors. What is the proper service I should be referencing to get an email address?

Joe Gregorio

unread,
Dec 8, 2012, 6:08:06 PM12/8/12
to google-api-p...@googlegroups.com
The list of APIs and the name and version to pass into build()
are available here:

http://api-python-client-doc.appspot.com/

The name and version are the last two columns on that page.

I believe the API you want is oauth2:

https://google-api-client-libraries.appspot.com/documentation/oauth2/v2/python/latest/oauth2_v2.userinfo.html#get

-joe
Reply all
Reply to author
Forward
0 new messages