Script button click notifications not working suddenly

  • How can I check if my ASPN development certificate is working?

  • My python script gives the following error:

    Traceback (most recent call last):
      File "pushnot.py", line 15, in <module>
        wrapper.notify()
      File "build/bdist.macosx-10.9-intel/egg/APNSWrapper/notifications.py", line 194, in notify
      File "build/bdist.macosx-10.9-intel/egg/APNSWrapper/connection.py", line 215, in connect
      File "build/bdist.macosx-10.9-intel/egg/APNSWrapper/connection.py", line 161, in connect
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 333, in connect
        self._real_connect(addr, False)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 323, in _real_connect
        self.do_handshake()
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 305, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
    
          

Any idea why?

+3


source to share


1 answer


I managed to fix this by using TLSv1 instead of SSLv3 to establish a connection to the APNS server. The problem is that the python SSL library is linking to the legacy OpenSSL OSSS library (v0.9.8 on my machine). This version apparently no longer makes correct connections to the APNS server when using SSLv3. So instead of setting ssl_version, set PROTOCOL_TLSv1 like:

sock = socket()
sock = ssl.wrap_socket(sock, ssl_version=ssl.PROTOCOL_TLSv1, certfile=certfile)
sock.connect(('sandbox.push.apple.com, 2195))

      



And you shouldn't get the handshake failure error anymore.

+3


source







All Articles