2015-06-25 42 views

回答

0
  1. 你不能在沒有使用oauth的情況下使用它。
  2. 有一個很好的庫叫gspread - 檢查出來。
  3. 運行OAuth是如下面的代碼示例一樣簡單(你應該先創建一個google developer account,讓你的私鑰等
  4. 請參見下面的代碼示例(使用gspread)

from oauth2client.client import SignedJwtAssertionCredentials 

def authenticate_and_get_spreadsheet(): 
    scope = ['https://spreadsheets.google.com/feeds'] 
    client_email = get_client_email() # something that looks like [email protected]account.com 
    private_key = get_private_key() 
    credentials = SignedJwtAssertionCredentials(client_email, private_key, scope) 
    gc = gspread.authorize(credentials) 
    return gc 


def get_spreadsheet(): 
    gc = authenticate_and_get_spreadsheet() 
    ss = gc.open_by_key('1FxDkjsdhffQOPC-f93Cccebkjasd5NMzl4AahDk') # document key 
    return ss # now you can read/write this spreadsheet 
+0

謝謝,我解決了使用OAuth2的問題 – minji

相關問題