2013-02-25 76 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