djacobs / PyAPNs

Python library for interacting with the Apple Push Notification service (APNs)
http://pypi.python.org/pypi/apns/
MIT License
1.22k stars 377 forks source link

Is there an Error In Documentation #176

Open ashish7195 opened 7 years ago

ashish7195 commented 7 years ago

In case of enhanced notifications, the apns object in the documentation don't have the key file in it. Have you missed it by chance or it will work like that. Because my code gets blocked if I don't add the key file but work by including it.

apns_enhanced = APNs(use_sandbox=True, cert_file='apns.pem', enhanced=True)

Also, I am getting the following error in both the cases.

apns.gateway_server.send_notification(token_hex, payload, identifier=identifier)
  File "/usr/local/lib/python2.7/dist-packages/apns.py", line 533, in send_notification
    self.write(message)
  File "/usr/local/lib/python2.7/dist-packages/apns.py", line 263, in write
    _, wlist, _ = select.select([], [self._connection()], [], WAIT_WRITE_TIMEOUT_SEC)
  File "/usr/local/lib/python2.7/dist-packages/apns.py", line 254, in _connection
    self._connect()
  File "/usr/local/lib/python2.7/dist-packages/apns.py", line 216, in _connect
    self._ssl.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
AttributeError: 'NoneType' object has no attribute 'do_handshake'