使用python

时间:2017-04-26 08:32:46

标签: python python-3.x google-plus google-oauth

我想访问用户的电子邮件。在我的范围内,我已输入https://www.googleapis.com/auth/userinfo.email,但它不会返回用户邮件。

我的代码:

FLOW = OAuth2WebServerFlow(
        client_id=client id,
        client_secret=client secret,
        scope=('https://www.googleapis.com/auth/plus.login','https://www.googleapis.com/auth/plus.me','https://www.googleapis.com/auth/userinfo.email','https://www.googleapis.com/auth/userinfo.profile','https://mail.google.com/'),
        user_agent=app/name,redirect_uri='http://localhost')
auth_uri = FLOW.step1_get_authorize_url()
print(auth_uri)
credentials=FLOW.step2_exchange(code)

print(credentials)    

storage = Storage('log2.json')
storage.put(credentials)
credentials = storage.get()


print(credentials)
f=open("log2.json","r")
print(f.read())
f.close()

f.read只给我用户基本信息,我如何阅读用户电子邮件?

有什么建议吗?

0 个答案:

没有答案