Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Error while sending notification #29

Closed
sush opened this Issue · 2 comments

3 participants

@sush

Hi,

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/server.py", line 132, in process
        self.render(resrc)
      File "/usr/local/lib/python2.7/dist-packages/Twisted-12.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py", 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/resource.py", 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/xmlrpc.py", 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/defer.py", line 134, in maybeDeferred
        result = f(*args, **kw)
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/server.py", line 292, in xmlrpc_notify
        aps_dict_or_list))
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/server.py", line 199, in write
        return client.sendMessage(notifications)
      File "/usr/local/lib/python2.7/dist-packages/pyapns-0.4.0-py2.7.egg/pyapns/server.py", 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

@dhg1

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

@krasio

Hi,

For ruby client you can either use arrays

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

or switch to https://github.com/krasio/pyapns_gem. This is fixed in development branch. Just add

gem 'pyapns', git: 'git://github.com/krasio/pyapns_gem.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.