下面是代码

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'


基于此blog

使用此google-api-python-client

最佳答案

我发现这篇帖子oauth2client与问题有关,就我而言,在撰写本文时,已解决了将问题更新为pyOpenSSL最新版本16.2.0的问题。

10-04 11:48