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
from apns2 import APNSClient, Notification, Payload, PayloadAlert
cli = APNSClient(mode="dev", client_cert="/your/path.pem")
alert = PayloadAlert(body="body!", title="title!")
payload = Payload(alert=alert)
n = Notification(payload=payload, priority=5)
response = cli.push(n=n, device_token="your_token")
assert response.status_code == 200, response.reason
assert response.apns_id
```
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
from apns2 import APNSClient, Notification, Payload, PayloadAlert
cli = APNSClient(mode="dev", client_cert="/your/path.pem")
alert = PayloadAlert(body="body!", title="title!")
payload = Payload(alert=alert)
n = Notification(payload=payload, priority=5)
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.4.tar.gz
(6.2 kB
view details)
File details
Details for the file apns2-client-0.4.tar.gz
.
File metadata
- Download URL: apns2-client-0.4.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8802ff836319e2214d2e7042802140bffaa9ba0b5d7478228ef1aa41d77c3256 |
|
MD5 | 4cd454d807ea128cdf868bf496c197fc |
|
BLAKE2b-256 | 35a4361085db1a1d9350c0a07f36d5a6284f53c4ca328a542efd4a23e79ca969 |