0

サービス アカウントを使用して Google アナリティクスに接続しようとしていますが、次のエラーが表示されます。

SSLHandshakeError at ...
[Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

PyOpenSSL と PyCrypto をインストールして更新しました。

接続に使用するコードは次のとおりです。

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

def initialize_service():
    f = open('path_to_key_file.p12', 'rb')

    key = f.read()
    f.close()    
    credentials = SignedJwtAssertionCredentials('XXXX@developer.gserviceaccount.com', key, scope='https://www.googleapis.com/auth/analytics.readonly')
    http = httplib2.Http()
    http = credentials.authorize(http)
    print 'This is printed'
    service = build('analytics', 'v3', http=http)
    print 'This is not printed'

    return service
4

1 に答える 1

0

システムクロックが現在の時刻に設定されていないために問題が発生したようです。

于 2013-08-23T12:46:58.733 に答える