I got a bug up my ass and made an update to pyapns. pyapns is a server that provides an XML-RPC interface and native python and ruby clients to Apple's Push Notification gateway for any number of apps. Interestingly enough, pyapns has been running on several of my services untouched since I updated it last in 2010. Without modification it's weathered a major python version and 3 major twisted versions. In a recent Instagram engineering blog, they said they've sent over a billion notifications with it. Cool.
It's come time to update a few things. Mostly I just want to clean up the code, make it PEP8-friendly, move the docs to sphinx and onto rtfd.org. I have already added support for Apple's new notification API in another branch, and will finish that in time. Additionally I'm working on a REST interface for easier testing. But for now I have gone about closing some longer-standing and minor bugs.
First, and most important to yours truly, I wanted to find a clean way to automatically provision multiple apps upon startup of the pyapns server (opposed to provisioned by the clients). The de-facto way to provision your apps is to send the provision command to it from the client before sending notifications or retrieving feedbacks. It still works that way. I've just added support in the tac file (launched with twistd) for automatically provisioning apps and their certificates on startup.
In my [currently most interesting] environment I have a server [a micro EC2 instance] set up which hosts the pyapns server to which a bunch of other servers connect. I want to be able to deploy one of these in every availability zone for minimum latency and redundancy. Since I have a limited number of apps (two for every app store beta account, and two for production) it makes sense to just ship the servers with the certs already loaded up, and not bother the clients with worrying about provisioning.
To see how this is done check out example_tac.tac and example_conf.json. Easy as pie.
Second, and third I've fixed bugs #21 (security issue logging cert contents when full thing provided via network) and #25 (explicit re-provision required by client when pyapns restarted).
And finally I've made some changes to the API, primarily making the standard Python API more explicit by making you specify async=True if you want the call to be asynchronous. Also, you can now specify a errback which will be called back
with the exception should one occur in the thread.
Release 0.4.0 is available on PyPI right now!