Skip to main content

kalyke

Test Maintainability uv Ruff codecov

PyPI Package version Python Supported versions wheel format implementation LICENSE

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.event default value is LiveActivityEvent.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).

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-1.2.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kalyke_apns-1.2.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file kalyke_apns-1.2.2.tar.gz.

File metadata

  • Download URL: kalyke_apns-1.2.2.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kalyke_apns-1.2.2.tar.gz
Algorithm Hash digest
SHA256 51f98cca7a52e8edeb61ad58ccd6bbd03bd3298729708c2eb20acb874f523805
MD5 c5448d7e97c6c4372d93e2ca27ab31ae
BLAKE2b-256 5c3bde745ee53cf2f82b5d4a9ad0ef859c1759129be9f8a8bcd0bda147531a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyke_apns-1.2.2.tar.gz:

Publisher: release.yml on nnsnodnb/kalyke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kalyke_apns-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: kalyke_apns-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kalyke_apns-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 22c5a36f972d9329803deb38455d0714c3e909e1d729eb889d7dd5fd764995de
MD5 45baffa25f934a82a83532d11ef98a70
BLAKE2b-256 95dbe60dab22f439b16773f7bb1afe6b31fe5b7d225d4bf812636a6ab3f2c645

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyke_apns-1.2.2-py3-none-any.whl:

Publisher: release.yml on nnsnodnb/kalyke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.2.2 This release

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.6

2 files

1.0.5

2 files

1.0.4

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page