Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hennge/aapns
Asynchronous Apple Push Notifications
https://github.com/hennge/aapns
apns apns2 apple asyncio ios push-notifications python3
Last synced: 15 days ago
JSON representation
Asynchronous Apple Push Notifications
- Host: GitHub
- URL: https://github.com/hennge/aapns
- Owner: HENNGE
- License: other
- Created: 2017-05-10T03:26:25.000Z (over 7 years ago)
- Default Branch: default
- Last Pushed: 2023-07-07T03:25:50.000Z (over 1 year ago)
- Last Synced: 2024-12-03T15:15:43.606Z (19 days ago)
- Topics: apns, apns2, apple, asyncio, ios, push-notifications, python3
- Language: Python
- Homepage: https://aapns.readthedocs.io/en/latest/
- Size: 277 KB
- Stars: 13
- Watchers: 33
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# AAPNS
[![CircleCI](https://circleci.com/gh/HENNGE/aapns.svg?style=svg)](https://circleci.com/gh/HENNGE/aapns)
[![Documentation Status](https://readthedocs.org/projects/aapns/badge/?version=latest)](http://aapns.readthedocs.io/en/latest/?badge=latest)Asynchronous Apple Push Notification Service client.
* Requires TLS 1.2 or better
* Requires Python 3.8 or better## Quickstart
```python
from aapns.api import Server
from aapns.config import Priority
from aapns.models import Notification, Alert, Localizedasync 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()
```