Gdata python Google 应用程序身份验证 [英] Gdata python Google apps authentication

查看:36
本文介绍了Gdata python Google 应用程序身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经能够按照 gdata 下载包中的示例/电子表格使用 gdata python client.programmaticlogin 函数登录到 Google 电子表格.

I have been able to login to Google spreadsheet with gdata python client.programmaticlogin function following the sample/spreadsheet in gdata downloaded pack.

现在我无法登录到我的企业 gapps 'me@mycompany.com' 我是否必须通过任何其他武器?我尝试使用托管帐户类型不起作用.

Now I am not able to login to my enterprise gapps 'me@mycompany.com' do I have to pass any other arms? I tried with account type Hosted didn't work.

我尝试从 gui 创建 oath2 密钥,我生成了我的客户端 ID 和电子邮件 ID.在 gdata 中运行 oauth 示例需要消费者密钥和秘密密钥.有人可以就此提出建议吗?

I tried creating oath2 key from gui, I have my client id and email id generated. Running the oauth sample in gdata asks for consumerkey and secret key. Can somebody advise on this please?

推荐答案

好的,我用下面的方法解决了

ok I got it solved with the below

import gdata.gauth

Client_id='xxx';
Client_secret='yyy'
Scope='https://spreadsheets.google.com/feeds/'
User_agent='myself'

token = gdata.gauth.OAuth2Token(client_id=Client_id,client_secret=Client_secret,scope=Scope,user_agent=User_agent)
print token.generate_authorize_url(redirect_uri='urn:ietf:wg:oauth:2.0:oob')
code = raw_input('What is the verification code? ').strip()
token.get_access_token(code)
print "Refresh token
"
print token.refresh_token
print "Access Token
"
print token.access_token

这篇关于Gdata python Google 应用程序身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆