Skip to main content

A robust client library for Apple's push notification service.

Project description

This is a client library for Apple’s push notification service. It is not the first such library for Python, but, as is often the way, the existing options didn’t quite meet our needs:

  1. No dependencies (other than six).

  2. Fire and forget. APNs is a quirky binary protocol that frequently requires reconnecting to the service and re-sending notifications after an error.

  3. Robust. We don’t do quick and dirty here. Readability, tests, and documentation are not optional.

Quick start

An APNs client is by nature stateful. The default apns-worker backend uses Python threads to asynchronously process a queue of messages to send to the service. Most users will want to maintain a global ApnsManager instance to process messages. Note that if your own program is threaded, you may need to take care to create this global instance safely.

from apns_worker import ApnsManager

apns = None

def init_apns(key_path, cert_path):
    """ Call this once at program init time. """
    global apns
    apns = ApnsManager(key_path, cert_path)

def send_badge(token, badge=1):
    """ Badge the app on a single device. """
    apns.send_aps([token], badge=badge)

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

apns-worker-0.1.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

apns_worker-0.1-py2.py3-none-any.whl (22.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file apns-worker-0.1.tar.gz.

File metadata

  • Download URL: apns-worker-0.1.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for apns-worker-0.1.tar.gz
Algorithm Hash digest
SHA256 1fc300497e914456d06eee7cac22d191c7164214a32bf8a29e390ff877c0604d
MD5 8aafd27a31ef82b73bc700a624b4388f
BLAKE2b-256 0eb32c08839ee9cb57740267c24ff99ccce87f90c8d4ebb307607bd34bb7c32d

See more details on using hashes here.

File details

Details for the file apns_worker-0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for apns_worker-0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d5081549ed44a042971bf855bd794c288317f1a86e801e3ccd833057a32de089
MD5 3fb9b7fde44013716168cc9987237513
BLAKE2b-256 9a731db0dc1a14aadb72fd09bd4de3cafd04eedde61a5f25a501cbccee74aaf9

See more details on using hashes here.

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