Skip to main content

apns2-client is a python package designed for simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the new HTTP/2 Push provider API.

Project description

# apns2-client

apns2-client is a python package designed for simple, flexible and fast Apple Push Notifications on iOS, OSX and Safari using the new HTTP/2 Push provider API.

Creation of this package was inspired by @sideshow's [apns2](https://github.com/sideshow/apns2) golang package.

## Features

- Uses new Apple APNs HTTP/2 connection
- Supports new iOS 10 features such as Collapse IDs, Subtitles and Mutable Notifications
- Supports persistent connections to APNs

## Cautions

- Works only with Python 3.5 and later

## Install

- Make sure you have [pip](https://pip.pypa.io/en/stable/installing/) installed.
- Install `apns2-client`:

```sh
pip install apns2-client
```

## Example

```python
import apns2


cli = apns2.APNSClient(mode="dev", client_cert="/your/path.pem")
alert = apns2.PayloadAlert(body="body!", title="title!")
payload = apns2.Payload(alert=alert)
n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW)
response = cli.push(n=n, device_token="your_token")
assert response.status_code == 200, response.reason
assert response.apns_id
```


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

apns2-client-0.5.3.tar.gz (6.3 kB view details)

Uploaded Source

File details

Details for the file apns2-client-0.5.3.tar.gz.

File metadata

File hashes

Hashes for apns2-client-0.5.3.tar.gz
Algorithm Hash digest
SHA256 164277a7df5e45ef0f4b2d8abc72b47852b81daa65d7d542ec8d6e125a3f114d
MD5 ca3285068d61cb12b65ce312628561f7
BLAKE2b-256 09c444d92b91ac5a61437a99aac0e158dedffb8220a905339caa4374f5937dec

See more details on using hashes here.

Supported by

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