2
votes

So I am able to send messages using apns_client ( more so lately using apns_clerk because of the ssl error)

But now i need to use eventlet to make is nonblocking.

so i was suggested to go and monkeypatch all the libraries in the very beginning.

so i do

import eventlet eventlet.monkey_patch()

the problem is now i get this error and am not able to send messages:-

' WARNING:apns_clerk.backends.stdio:Failed to establish socket/SSL connection to ('gateway.sandbox.push.apple.com', 2195) Traceback (most recent call last): File "build/bdist.linux-x86_64/egg/apns_clerk/backends/stdio.py", line 168, in _open_connection self._connect_and_handshake() File "build/bdist.linux-x86_64/egg/apns_clerk/backends/stdio.py", line 205, in _connect_and_handshake self._connection.do_handshake() WantReadError'

https://bitbucket.org/sardarnl/apns-client/overview

2

2 Answers

0
votes

Please provide more information to debug your problem: python -V python -c 'import eventlet; print(eventlet.__version__)' URL to which you are trying to connect or minimal code to reproduce it.

Try to update to latest eventlet v0.16, there was a bug fix related to Python 2.7.9.

You may want to open an issue here https://github.com/eventlet/eventlet/issues/new

0
votes

I use Python3.4.3 and eventlet 0.17.4 and have the same problem.

Seems that we should use eventlet's version of OpenSSL. Here is my (very dirty) workaround, for now couldn't figure out anything better:

  • in eventlet/green/OpenSSL/init.py fix imports to be compatible with python3 (import rand -> from . import rand)
  • In apns_clerk/backends/stdio.py replace import OpenSSL with from eventlet.green import OpenSSL.

This worked for me. (Another issue is it hangs if there is only one valid device, I worked it around by adding «dummy» invalid device.)

I believe there is a better way to make apns_clerk use greenified OpenSSL, but I couldn't (yet) figure it out becuase eventlet documentation is very silent about it.