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.1.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.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kalyke_apns-1.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 36e9fa9886cd170d9380529e4048461cb5e5368c8e33324116ec5a38022d4b02
MD5 7bc36386ecfe234834d27aa47d3f1c1f
BLAKE2b-256 2a6d02889eab8959c4e25825641e6097e99a511ac2d348c5c79703b8d8082c7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyke_apns-1.2.1.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.1-py3-none-any.whl.

File metadata

  • Download URL: kalyke_apns-1.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a7848225b946a9bf46a404dc4401515d8ce46018cae41bc74f4b85febc3842c4
MD5 dd796ed1253d33d1ee0f784d97d17748
BLAKE2b-256 87e3c723055fecf3b600de6b161c819b2c01429aa0108faeb9579ec6c38cd6fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for kalyke_apns-1.2.1-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

1.2.2

2 files

This release

1.2.1 This release

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