Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Error while sending notification #29

sush opened this Issue · 2 comments

3 participants



I have configured the pyapns server (with Twistd 12.0.0.) and get errors with both ruby (1.9.3p125) client and python (2.7.2) client when I try the following command and all its polymorphic forms :

    client.notify 'my_app_id', 'my_device_token', {:aps=> {:alert => 'hello?'}}

server side :

    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/", line 132, in process
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/", line 167, in render
        body = resrc.render(self)
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/", line 216, in render
        return m(request)
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/", line 172, in render_POST
        d = defer.maybeDeferred(function, *args)
    --- <exception caught here> ---
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/internet/", line 134, in maybeDeferred
        result = f(*args, **kw)
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/", line 292, in xmlrpc_notify
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/", line 199, in write
        return client.sendMessage(notifications)
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/", line 77, in sendMessage
        log.msg('APNSProtocol sendMessage msg=%s' % binascii.hexlify(msg))
    exceptions.TypeError: must be string or buffer, not None

client side : error 8002


same here. it looks like the encode_notifications method doesn't handle this case. neither if or the else block executes



For ruby client you can either use arrays

client.notify 'my_app_id', ['my_device_token'], [{:aps=> {:alert => 'hello?'}}]

or switch to This is fixed in development branch. Just add

gem 'pyapns', git: 'git://', branch: 'development'

to your Gemfile.

P.S. I have to merge this to master and push new version to rubygems, but since we're still using this for staging only (app is not released yet) I wanted to test changes for some more time.

@sush sush closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.