Gdata python Google Apps身份验证 [英] Gdata python Google apps authentication
问题描述
按照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.
现在我无法登录到我的企业漏洞'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示例要求输入Consumerkey和Secret Key.有人可以对此提出建议吗?
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\n"
print token.refresh_token
print "Access Token\n"
print token.access_token
这篇关于Gdata python Google Apps身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!