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.10 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,
)
)
LiveActivity
[!NOTE]
- The topic suffix must be
.push-type.liveactivity.LiveActivityPayload.eventdefault value isLiveActivityEvent.UPDATE.
import asyncio
from datetime import datetime
from kalyke import LiveActivityClient, LiveActivityApnsConfig, LiveActivityEvent, LiveActivityPayload, PayloadAlert
client = LiveActivityClient(
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 = LiveActivityPayload(
alert=payload_alert,
badge=1,
sound="default",
timestamp=datetime.now(),
event=LiveActivityEvent.UPDATE,
content_state={
"currentHealthLevel": 100,
"eventDescription": "Adventure has begun!",
},
)
config = LiveActivityApnsConfig(
topic="com.example.App.push-type.liveactivity",
)
asyncio.run(
client.send_message(
device_token=registration_id,
payload=payload,
apns_config=config,
)
)
VoIP
[!NOTE]
- The topic suffix must be
.voip.
import asyncio
from pathlib import Path
from kalyke import VoIPApnsConfig, VoIPClient
client = VoIPClient(
use_sandbox=True,
auth_key_filepath=Path("/") / "path" / "to" / "YOUR_VOIP_CERTIFICATE.pem",
)
registration_id = "a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500"
payload = {"key": "value"}
config = VoIPApnsConfig(
topic="com.example.App.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kalyke_apns-1.2.0.tar.gz.
File metadata
- Download URL: kalyke_apns-1.2.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6597bd6b8d219831b6c775c1656cbbf2e688ac153a428ce89b1a3c06ab192317
|
|
| MD5 |
bbaf841596fbaa9681ab3a0898647b8b
|
|
| BLAKE2b-256 |
8669bddcf33af9623b47fa54c07a9576d8edfc5cbbd45795afc32ccc60c4780d
|
Provenance
The following attestation bundles were made for kalyke_apns-1.2.0.tar.gz:
Publisher:
release.yml on nnsnodnb/kalyke
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalyke_apns-1.2.0.tar.gz -
Subject digest:
6597bd6b8d219831b6c775c1656cbbf2e688ac153a428ce89b1a3c06ab192317 - Sigstore transparency entry: 597463010
- Sigstore integration time:
-
Permalink:
nnsnodnb/kalyke@de65bc073b0b3a0534bb3d49d7801c52d2a6472e -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/nnsnodnb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de65bc073b0b3a0534bb3d49d7801c52d2a6472e -
Trigger Event:
push
-
Statement type:
File details
Details for the file kalyke_apns-1.2.0-py3-none-any.whl.
File metadata
- Download URL: kalyke_apns-1.2.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28afce03ab688c73e6aab3f52c560b4643498e2dae1dd387765a3f5d60ef321d
|
|
| MD5 |
d1302f8cee15e732fabe6e03d3d3e804
|
|
| BLAKE2b-256 |
c23c3c76ef2f4c522bed60c292177bf1c5c2b7daff74865003fe9128beabce17
|
Provenance
The following attestation bundles were made for kalyke_apns-1.2.0-py3-none-any.whl:
Publisher:
release.yml on nnsnodnb/kalyke
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kalyke_apns-1.2.0-py3-none-any.whl -
Subject digest:
28afce03ab688c73e6aab3f52c560b4643498e2dae1dd387765a3f5d60ef321d - Sigstore transparency entry: 597463016
- Sigstore integration time:
-
Permalink:
nnsnodnb/kalyke@de65bc073b0b3a0534bb3d49d7801c52d2a6472e -
Branch / Tag:
refs/tags/1.2.0 - Owner: https://github.com/nnsnodnb
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@de65bc073b0b3a0534bb3d49d7801c52d2a6472e -
Trigger Event:
push
-
Statement type: