2013-02-25 60 views
6

我已经能够使用gdata python client.programmaticlogin函数在gdata下载包中的示例/电子表格中登录到Google电子表格。Gdata python谷歌应用程序认证

现在我无法登录到我的企业gapps'[email protected]'是否必须通过其他任何武器?我尝试使用帐户类型托管没有工作。

我试图从gui创建oath2键,我有我的客户端ID和生成的电子邮件ID。在gdata中运行oauth样本要求使用consumerkey和密钥。有人可以提供这方面的建议吗?

回答

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 
+0

什么是验证码? – John 2016-05-03 05:08:13

0

看一看如何使用客户端登录的示例here。它是我为创建Google Spreadsheet而创建的一个库的一部分。

+0

进口gdata.gauth CLIENT_ID = 'XXX' 解决; Client_secret = 'YYY' 范围=的 'https://spreadsheets.google.com/feeds/' USER_AGENT = '自己' 标记= gdata.gauth.OAuth2Token(CLIENT_ID = CLIENT_ID,client_secret = Client_secret,范围=范围,'user_agent = User_agent') print.transaction_authorize_url(redirect_uri ='urn:ietf:wg:oauth:2.0:oob') code = raw_input('什么是验证码?').strip() token.get_access_token代码) print“Refresh token \ n” print token.refresh_token print“Access Token \ n” print token.access_token – karthik 2013-03-08 10:23:53