Search code examples
pythonpippackageeasy-installpyapns

PyAPNs version 1.1.2 doesn’t have enhanced keyword?


I’m sure this is obvious, but I’m missing it. I’ve installed PyAPNs via pip:

# pip install apns

Then when I try to use the “enhanced” flag in APNs, it’s not there.

# python
Python 2.7.6 (default, Nov 11 2013, 18:34:29) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from apns import APNs
>>> server = APNs(use_sandbox=True, cert_file=“/mydir/apns-dev-cert.pem", key_file=“/mydir/apns-dev-key.pem", enhanced=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'enhanced'
>>> 

And sure enough the 1.1.2 version that pip installed doesn’t have that keyword. But I thought this was the latest released version in the PyAPNs repository https://github.com/djacobs/PyAPNs.

I want to use the ‘enhanced’ keyword, for error checking. Any ideas?


Solution

  • Version 1.1.2 that is currently available on PyPI doesn't provide an enhanced argument for APNs class (see source).

    If you want this functionality, install the module directly from github (master branch):

    pip install git+https://github.com/djacobs/PyAPNs.git
    

    Note that they haven't updated the package version in setup.py, so, if you have this module installed already, uninstall it first, then install it from github:

    pip uninstall apns
    pip install git+https://github.com/djacobs/PyAPNs.git