Pr0Ger / PyAPNs2

Python library for interacting with the Apple Push Notification service (APNs) via HTTP/2 protocol
MIT License
349 stars 179 forks source link

What will be the effort to make this work for Python 2? #18

Closed adukic closed 7 years ago

protoss-player commented 8 years ago

It should be working fine with Python 2.7 as it is. I'm using PyAPNs2 with Py2.7 in production.

In case you have any specific problem with Python 2 and this library, please provide additional info.

ashishsharma0921 commented 8 years ago

I am getting this error AttributeError: 'NoneType' object has no attribute 'SSL_ERROR_WANT_READ' at "hyper/http20/connection.py" while using Python 2.7. I can see a hyper/compat.py where we are finding the versions and using ssl or ssl_compat. I dont know y its not working. Whenever I am deploying the project, server crashes with the above error. Can you please suggest some work around for it ?

protoss-player commented 8 years ago

Which specific version of 2.7 are you using? SSL issues are very likely to be caused by using older interpreter revisions. In 2.7.9+ there were major improvements applied to the SSL library, so you should consider upgrading.

matangover commented 7 years ago

We're also running PyAPNs2 on Python 2.7 without a problem.

PyAPNs2 requires Python to be compiled with OpenSSL 1.0.2 or greater for ALPN support in hyper. You can check the OpenSSL version on your server using:

import ssl
print ssl.OPENSSL_VERSION_INFO
print ssl._OPENSSL_API_VERSION

Both versions should be 1.0.2 or greater. If you install the latest Python for your platform, you will probably get a compatible version, but sometimes you'll have to compile your own Python or OpenSSL. If you're running on Heroku, see this note.

Proper-Job commented 7 years ago

@adukic Are you by any chance deploying using gevent? Gevent monkey patches the SSLSocket implementation. I've had problems with gevent and APNS in the past.