2012-07-20 64 views
1

我使用google-python-client-api作爲Blogger API(服務帳戶 - OAuth)。Google Blogger API:AccessTokenRefreshError:invalid_grand訊息

這是我的代碼(這是考慮我的任務API example

import httplib2 
import pprint 
import sys 

from apiclient.discovery import build 
from oauth2client.client import SignedJwtAssertionCredentials 

f = file("privatekey.p12", "rb") 
key = f.read() 
f.close() 

credentials = SignedJwtAssertionCredentials(
    "[email protected]", 
    key, 
    scope = "https://www.googleapis.com/auth/blogger") 

http = httplib2.Http() 
http = credentials.authorize(http) 

service = build("blogger", "v3", http=http) 
當我運行這段代碼

,其顯示

Message File Name Line Position  
Traceback    
    <module> D:\Code\myScripts\py\gData.py 20  
    build build\bdist.win32\egg\apiclient\discovery.py 191  
    new_request build\bdist.win32\egg\oauth2client\client.py 402  
    _refresh build\bdist.win32\egg\oauth2client\client.py 569  
    _do_refresh_request build\bdist.win32\egg\oauth2client\client.py 625  
AccessTokenRefreshError: invalid_grant  

有什麼問題,我應該如何解決呢? ?

我甚至嘗試tasks.py示例代碼..及其甚至出現同樣的錯誤

我非常確信服務帳戶的電子郵件地址是正確

回答