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.7 or later.
$ pip install kalyke-apns
Usage
APNs
import asyncio
from kalyke import ApnsClient, ApnsConfig, Payload, PayloadAlert
client = ApnsClient(
use_sandbox=True,
team_id="YOUR_TEAM_ID",
auth_key_id="AUTH_KEY_ID",
auth_key_filepath="/path/to/AuthKey_AUTH_KEY_ID.p8",
)
registration_id = "a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500"
payload_alert = PayloadAlert(title="YOUR TITLE", body="YOUR BODY")
payload = Payload(alert=payload_alert, badge=1, sound="default")
config = ApnsConfig(topic="com.example.App")
asyncio.run(client.send_message(device_token=registration_id, payload=payload, apns_config=config))
VoIP
import asyncio
from pathlib import Path
from kalyke import ApnsConfig, ApnsPushType, VoIPClient
client = VoIPClient(
use_sandbox=True,
auth_key_filepath=Path("/") / "path" / "to" / "YOUR_VOIP_CERTIFICATE.pem",
)
registration_id = "a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500"
payload = {"key": "value"}
config = ApnsConfig(topic="com.example.App.voip", push_type=ApnsPushType.VOIP)
asyncio.run(client.send_message(device_token=registration_id, payload=payload, apns_config=config))
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.2.2.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for kalyke_apns-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbfe6d925f4f1defe268894ba920a883fb7563f1590599199fb3a11bdb2a8156 |
|
MD5 | 3888e3de076a48ca6c079a2689913b22 |
|
BLAKE2b-256 | 9d02bb02bfb9df099e0abde62bb427753e849aea21376243d81338db878c4ae2 |