2

以下はコードです

import httplib2, argparse, os, sys, json
from oauth2client import tools, file, client
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient import discovery
from googleapiclient.errors import HttpError

scope = ['https://www.googleapis.com/auth/prediction','https://www.googleapis.com/auth/devstorage.read_only']

def get_api(api, scope, service_account=True):
     storage = file.Storage('oAuth2.json')
     creds = storage.get()

     if creds is None or creds.invalid:
        creds = ServiceAccountCredentials.from_json_keyfile_name('service_account.json',
                                                             scopes=scope)
        storage.put(creds)

     http = creds.authorize(httplib2.Http())
     return discovery.build(api, 'v1.6', http=http)

api = get_prediction_api('prediction')

以下はエラーです

TypeError: 不明なサイズの ctype 'EVP_MD_CTX' をインスタンス化できません

このブログを元に

このgoogle-api-python-client の使用

4

3 に答える 3

3

問題に関連するこの投稿oauth2clientを見つけました。私の場合、執筆時点でpyOpenSSLの最新バージョン16.2.0に更新することで問題は解決しました。

于 2017-01-04T13:21:13.440 に答える
1

インストールした google-api-python-client (上記のリンク) は、python2 でのみ動作します。現在、conda env 内の python2 では動作せず、conda env の外部でのみ動作し、python 3.5 では動作しません。

于 2016-12-16T17:41:23.080 に答える