Skip to main content

Asynchronous Apple Push Notification Service Client

Project description

AAPNS

CircleCI Documentation Status

Asynchronous Apple Push Notification Service client.

  • Requires TLS 1.2 or better
  • Requires Python 3.8 or better

Quickstart

from aapns.api import Server
from aapns.config import Priority
from aapns.models import Notification, Alert, Localized

async def send_hello_world():
    client = await Server.production('/path/to/push/cert.pem').create_client()
    apns_id = await client.send_notification(
        'my-device-token',
        Notification(
            alert=Alert(
                body=Localized(
                    key='Hello World!',
                    args=['foo', 'bar']
                ),
            ),
            badge=42
        ),
        priority=Priority.immediately
    )
    print(f'Sent push notification with ID {apns_id}')
    await client.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aapns-23.7.tar.gz (14.3 kB view hashes)

Uploaded source

Built Distribution

aapns-23.7-py3-none-any.whl (16.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page