=====
PyPAP
=====

This library provides an implementation of the Push Access Protocol
from the WAP working group (WAP-247-PAP-20010429-a).

It currently covers everything except the client capabilities query
and version negotiation. It's currently built to support only the 2.0
specification.

========
Examples
========

The protocol specification makes no assumptions about the transport
layer. This library doesn't either. It provides all the low-level
objects and functions for creating and marshalling messages. Consumers
of this library should implement the transport layer and the API for
sending messages and receiving responses.

    from email.mime.text import MIMEText

    from pypap import entities
    from pypap.message import PAPMessage
    from pypap.serialize import decode, encode


    def push(transport, id, addresses, message, deliver_before=None, deliver_after=None):
        p = entities.PushSubmission(id)
        p.deliver_before=deliver_before
        p.deliver_after=deliver_after
        p.add_addresses(*addresses)
        m = MIMEText(message)
        pap = PAPMessage(control_part=p, content_part=m)

        response = transport.send(encode(pap))
        if response.status.code != "1000":
            raise Exception, "Error sending push: {0} {1}".format(
                response.status.code, response.status.description)

Until the documentation is filled out, the best place to look for
examples are in the unit tests.

============
Contributors
============

* James King <james@agentultra.com>


====
TODO
====

1. Client capabilities query
2. Version negotiation


=======
License
=======

This library and it's source code is (c) 2011 Polar Mobile Inc. and is
licensed for use under the terms and conditions of the MIT license.
