“SSLError:EOF发生违反协议”异常调用IBM Blockchain

时间:2016-08-02 10:31:13

标签: python ssl ibm-cloud hyperledger

我尝试从python访问IBM Hyperledger Blockchain。不幸的是,我在尝试连接时遇到了SSL协议错误。我已经搜索了互联网,特别是stackoverflow找到了解决方案。这是我做的:

  1. 设置IBM Hyperledger区块链服务并获取要使用的URL。

  2. 我尝试了CURL调用来访问API

  3. curl -X GET --header "Accept: application/json" "https://SOMETHING_vp0.us.blockchain.ibm.com:443/network/peers"

    这对我来说很好(想知道为什么我不需要passwd,但它有效)。

    1. 我试图从python访问相同的API,但是出错了。 Python2.7 => 2.7.12,requests => 2.10.0 on mac

      导入请求

      url =“https://SOMETHING_vp0.us.blockchain.ibm.com:443/network/peers

      response = requests.get(url)

      print response.status_code

    2. 访问https://www.google.com没有问题,但区块链返回:

      Traceback (most recent call last):
        File "/Users/ansi/development/hyperledger/mcp.py", line 9, in <module>
          response = requests.get(url)
        File "/Users/ansi/development/virtualenv/general/lib/python2.7/site-packages/requests/api.py", line 71, in get
          return request('get', url, params=params, **kwargs)
        File "/Users/ansi/development/virtualenv/general/lib/python2.7/site-packages/requests/api.py", line 57, in request
          return session.request(method=method, url=url, **kwargs)
        File "/Users/ansi/development/virtualenv/general/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
          resp = self.send(prep, **send_kwargs)
        File "/Users/ansi/development/virtualenv/general/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
          r = adapter.send(request, **kwargs)
        File "/Users/ansi/development/virtualenv/general/lib/python2.7/site-packages/requests/adapters.py", line 477, in send
          raise SSLError(e, request=request)
      requests.exceptions.SSLError: EOF occurred in violation of protocol (_ssl.c:590)
      

      我该怎么做才能解决问题? 非常感谢

0 个答案:

没有答案