Gdata python Google apps身份验证

2024-09-22 16:27:08 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经能够使用gdatapythonclient.programmaticlogin函数登录到Google电子表格,下面是gdata下载包中的sample/spreadsheet。在

现在我无法登录我的企业gapps'me@mycompany.com“我还需要其他武器吗?我试着用托管的帐户类型不起作用。在

我尝试从gui创建oath2密钥,我已经生成了我的客户机id和电子邮件id。在gdata中运行oauth示例需要consumerkey和密钥。有人能就这个问题提出建议吗?在


Tags: sample函数comidgoogle密钥企业电子表格
2条回答

查看here中有关如何使用客户端登录的示例。它是我创建的一个库的一部分,目的是简化与Google电子表格的工作。在

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

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

相关问题 更多 >