Skip to main content

A library for interacting with APNs and VoIP using HTTP/2.

Project description

kalyke

Test Maintainability Code style: black Coverage Status

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.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


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 details)

Uploaded Source

Built Distribution

kalyke_apns-0.2.2-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kalyke_apns-0.2.2.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.16 Linux/5.15.0-1037-azure

File hashes

Hashes for kalyke_apns-0.2.2.tar.gz
Algorithm Hash digest
SHA256 63a898fb65766645b735f3035cdbe4db9680b4ce5aa2bed70825e15f169fa9c5
MD5 9ef26c3ce741c7e1ad906807a6929a27
BLAKE2b-256 12c5924ca219c56bde9114ddd52e041a3ea424c29880e75d104e284c647e24df

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kalyke_apns-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.1 CPython/3.9.16 Linux/5.15.0-1037-azure

File hashes

Hashes for kalyke_apns-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfe6d925f4f1defe268894ba920a883fb7563f1590599199fb3a11bdb2a8156
MD5 3888e3de076a48ca6c079a2689913b22
BLAKE2b-256 9d02bb02bfb9df099e0abde62bb427753e849aea21376243d81338db878c4ae2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page