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_file_path=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.0.tar.gz
(9.4 kB
view hashes)
Built Distribution
Close
Hashes for kalyke_apns-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e806c57c0a1c669a4f21748eaa9991a7d25d9df5c34df6d29e83b2f29d9efb48 |
|
MD5 | beba6ac83446d99f6b29c3117d19b8ef |
|
BLAKE2b-256 | 2f7caf1548aa6ca7c9de86763ff6931ec1890d3e349627ebb3f331c5455aa66c |