Pushbullet和EOF违反协议(_ssl.c:590)

时间:2016-12-09 15:37:26

标签: python pyopenssl kodi pushbullet

从2天前Pushbullet Kodi addon停止工作,抛出此错误:

EOF违反协议(_ssl.c:590)

GET是通过httplib2制作的,你可以看到简单的代码there

奇怪的是,使用openssl cli我得到错误:

$ openssl s_client -connect api.pushbullet.com:443              
CONNECTED(00000003)
140625036449432:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 307 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID: 
    Session-ID-ctx: 
    Master-Key: 
    Key-Arg   : None
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    Start Time: 1481297548
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

的信息:

$ openssl version
OpenSSL 1.0.2j  26 Sep 2016
$ uname -a
Linux meanmachine 4.8.11-1-ARCH #1 SMP PREEMPT Sun Nov 27 09:26:14 CET 2016 x86_64 GNU/Linux

感谢您的任何建议!

编辑:

在Python2.7上抛出错误的代码:

import httplib2
h = httplib2.Http()
h.request('https://api.pushbullet.com/v2/devices', method='GET')

追踪(最近一次呼叫最后一次):

 File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 1609, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 1351, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 1272, in _conn_request
    conn.connect()
  File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 1036, in connect
    self.disable_ssl_certificate_validation, self.ca_certs)
  File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 80, in _ssl_wrap_socket
    cert_reqs=cert_reqs, ca_certs=ca_certs)
  File "/usr/lib/python2.7/ssl.py", line 933, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 601, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 830, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:590)

P.S。就像python3.5上的魅力一样。

2 个答案:

答案 0 :(得分:2)

解决了通过 httplib2 切换到请求 python lib。

并安装:

    // insert HTML code
insertHtml: function (url, title) {
    var imgHeight;
    var imgWidth;
    function setHTMLImageSize() {
        imgHeight = this.height;
        imgWidth = this.width;
        var ImageRatio = (imgHeight / imgWidth);
        if (imgWidth > 100) {
            imgWidth = 100;
            imgHeight = (imgWidth * ImageRatio);
        }
        return true;
    }
    var myImage = new Image();
    myImage.name = url;
    myImage.onload = setHTMLImageSize;
    myImage.src = url;
    if (imgWidth = 0) {
        imgWidth = 100;
    }
    if (imgHeight = 0) {
        imgHeight = 100;
    }
    this.get_designPanel().insertHTML("<a href=\"" + url + "\" target=\"" + "_blank" + "\" style=\"" + "text-decoration: none" + "\" ><img src=\"" + url + "\" title=\"" + title + "\" width=\"" + imgWidth + "\" height=\"" + imgHeight + "\" /></a><br/>click image to View full size<br/>");
}

答案 1 :(得分:0)

在OS X上,这解决了我的问题。

<div class="container"> <h2>Large Modal</h2> <button type="button" class="btn btn-info btn-lg" id="myModalBtn">Open Large Modal</button> <div class="modal fade" id="myModal" role="dialog"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Modal Header</h4> </div> <div class="modal-body"> <p>This is a large modal.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div> <script type="text/javascript"> $("#myModal").on('show.bs.modal', function() { console.log("open"); }); $("#myModal").on('hide.bs.modal', function() { console.log("close"); }); $("#myModalBtn").on("click",function(){ $("#myModal").modal({backdrop: 'static', keyboard: false}); $("#myModal").modal('show'); }); </script>