Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exceptions.KeyError: 10 from disconnections #55

Open
alleus opened this issue Sep 6, 2013 · 1 comment
Open

exceptions.KeyError: 10 from disconnections #55

alleus opened this issue Sep 6, 2013 · 1 comment

Comments

@alleus
Copy link

alleus commented Sep 6, 2013

I got another disconnect in the same manner as in #54, but this time something was recorded and I'm attempting to fetch the disconnections list. That, however, results in the following exception.

2013-09-06 07:05:46+0000 [HTTPChannel,51,127.0.0.1] Unhandled Error
    Traceback (most recent call last):
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/protocols/basic.py", line 581, in dataReceived
        why = self.lineReceived(line)
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 1611, in lineReceived
        self.allContentReceived()
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 1686, in allContentReceived
        req.requestReceived(command, path, version)
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/http.py", line 790, in requestReceived
        self.process()
    --- <exception caught here> ---
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 192, in process
        self.render(resrc)
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/server.py", line 241, in render
        body = resrc.render(self)
      File "/home/appcorn/lib/python2.7/Twisted-13.0.0-py2.7-linux-x86_64.egg/twisted/web/resource.py", line 250, in render
        return m(request)
      File "build/bdist.linux-x86_64/egg/pyapns/rest_service.py", line 171, in render_GET

      File "build/bdist.linux-x86_64/egg/pyapns/model.py", line 282, in to_simple

    exceptions.KeyError: 10

2013-09-06 07:05:46+0000 [HTTPChannel,51,127.0.0.1] 127.0.0.1 - - [06/Sep/2013:07:05:46 +0000] "GET /apps/***/production/disconnections HTTP/1.1" 500 4948 "-" "curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 OpenSSL/1.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2"

The crashing line of code: https://github.com/samuraisam/pyapns/blob/v50/pyapns/model.py#L282

I guess I can try to do some kind of workaround myself, but can I close the service without the disconnections list being cleared?

@alleus
Copy link
Author

alleus commented Sep 6, 2013

This is caused by a new status code from Apple:

Status code Description
10  Shutdown

A status code of 10 indicates that the APNs server closed the connection (for example, to perform maintenance). The notification identifier in the error response indicates the last notification that was successfully sent. Any notifications you sent after it have been discarded and must be resent. When you receive this status code, stop using this connection and open a new connection.

https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant