我已经能够使用gdata下载包中的示例/电子表格,使用gdata python client.programmaticlogin
函数登录Google电子表格。
现在我无法登录我的企业gapps' me@mycompany.com'我是否必须通过任何其他武器?我试过账号类型Hosted没有工作。
我尝试从gui创建oath2
密钥,我生成了客户端ID和电子邮件ID。在gdata中运行oauth示例会询问consumerkey和secret密钥。有人可以就此提出建议吗?
答案 0 :(得分:7)
好的,我用下面的解决方法解决了它。
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
答案 1 :(得分:0)
查看here以获取有关如何使用客户端登录的示例。它是我创建的库的一部分,以便简单地使用Google Spreadsheet。