A library for interacting with APNs and VoIP using HTTP/2.
Project description
kalyke
A library for interacting with APNs and VoIP using HTTP/2.
Installation
kalyke requires python 3.6 or later.
$ pip install kalyke-apns
Usage
APNs
from kalyke.client import APNsClient
from kalyke.payload import PayloadAlert, Payload
payload_alert = PayloadAlert(title="YOUR TITLE", body="YOUR BODY")
alert = Payload(alert=payload_alert, badge=1, sound="default")
client = APNsClient(
team_id="YOUR_TEAM_ID", auth_key_id="AUTH_KEY_ID", auth_key_filepath="/path/to/AuthKey_AUTH_KEY_ID.p8",
bundle_id="com.example.App", use_sandbox=True, force_proto="h2"
)
# or background push
"""
client = APNsClient(
team_id="YOUR_TEAM_ID", auth_key_id="AUTH_KEY_ID", auth_key_filepath="/path/to/AuthKey_AUTH_KEY_ID.p8",
bundle_id="com.example.App", use_sandbox=True, force_proto="h2", apns_push_type="background"
)
"""
# Send single push notification
registration_id = "a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500"
result = client.send_message(registration_id, alert)
# Send multiple push notifications
registration_ids = [
"87b0a5ab7b91dce26ea2c97466f7b3b82b5dda4441003a2d8782fffd76515b73",
"22a1b20cb67a43da4a8f006176788aa20271ac2e3ac0da0375ae3dc1db0de210"
]
results = client.send_bulk_message(registration_ids, alert)
VoIP
from kalyke.client import VoIPClient
client = VoIPClient(
auth_key_filepath="/path/to/YOUR_VOIP_CERTIFICATE.pem",
bundle_id="com.example.App.voip", use_sandbox=True
)
alert = {
"key": "value"
}
# Send single VoIP notification
registration_id = "14924adeeabaacc8b38cfd766965abffd0ee572a5a89e7ee26e6009a3f1a8e8a"
result = client.send_message(registration_id, alert)
# Send multiple VoIP notifications
registration_ids = [
"84b7120bf190d171ff904bc943455d6081274714b32c486fa28814be7ee921fb",
"afaa8dcedc99d420e35f7435edad4821dbad3c8c7d5071b2697da9bd7a5037ad"
]
results = client.send_bulk_message(registration_ids, alert)
Todo
- Tests
License
This software is licensed under the MIT License (See LICENSE).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
kalyke-apns-0.1.8.tar.gz
(9.4 kB
view details)
Built Distribution
File details
Details for the file kalyke-apns-0.1.8.tar.gz
.
File metadata
- Download URL: kalyke-apns-0.1.8.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.9 Linux/5.11.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c93690847d382c0dad0e9f11ca3f9509652df33e2be817521be44e1e43ce6a8 |
|
MD5 | c8f4cb97ba31c5b2e9e61aec8ddc6da4 |
|
BLAKE2b-256 | 5c303e21a59479f86a1b4e488d78f71433d0a25954842575ba17fbc6432ca982 |
Provenance
File details
Details for the file kalyke_apns-0.1.8-py3-none-any.whl
.
File metadata
- Download URL: kalyke_apns-0.1.8-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.9.9 Linux/5.11.0-1022-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 457810e524f6f23069db19d87c5a72197e96db8e9099a7a4d534ab3c6871c9f9 |
|
MD5 | 057973450ed3b115a145e1e1b03e00dd |
|
BLAKE2b-256 | 4808001f0add9f1963802c24ad642e976ea58a2ac1c3fde488a26d5a9be6aca4 |