# kalyke
![Test](https://github.com/nnsnodnb/kalyke/workflows/Test/badge.svg)
[![Maintainability](https://api.codeclimate.com/v1/badges/fb85bcf746e1f4025afa/maintainability)](https://codeclimate.com/github/nnsnodnb/kalyke/maintainability)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![codecov](https://codecov.io/gh/nnsnodnb/kalyke/graph/badge.svg)](https://codecov.io/gh/nnsnodnb/kalyke)
[![PyPI Package version](https://badge.fury.io/py/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
[![Python Supported versions](https://img.shields.io/pypi/pyversions/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
[![wheel](https://img.shields.io/pypi/wheel/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
[![format](https://img.shields.io/pypi/format/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
[![implementation](https://img.shields.io/pypi/implementation/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
[![LICENSE](https://img.shields.io/pypi/l/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)
A library for interacting with APNs and VoIP using HTTP/2.
## Installation
kalyke requires python 3.9 or later.
```bash
$ pip install kalyke-apns
```
## Usage
### APNs
```python
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`.
```python
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`.
```python
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](LICENSE)).
Raw data
{
"_id": null,
"home_page": "https://github.com/nnsnodnb/kalyke",
"name": "kalyke-apns",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.9",
"maintainer_email": null,
"keywords": "apns, voip, liveactivity, apns provider api, apple push notifications",
"author": "Yuya Oka",
"author_email": "nnsnodnb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/99/d3/8e528a5d591c7fef9339b1822094e480c466e99bf0957d821e8dc3cdb68d/kalyke_apns-1.0.5.tar.gz",
"platform": null,
"description": "# kalyke\n\n![Test](https://github.com/nnsnodnb/kalyke/workflows/Test/badge.svg)\n[![Maintainability](https://api.codeclimate.com/v1/badges/fb85bcf746e1f4025afa/maintainability)](https://codeclimate.com/github/nnsnodnb/kalyke/maintainability)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![codecov](https://codecov.io/gh/nnsnodnb/kalyke/graph/badge.svg)](https://codecov.io/gh/nnsnodnb/kalyke)\n\n[![PyPI Package version](https://badge.fury.io/py/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n[![Python Supported versions](https://img.shields.io/pypi/pyversions/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n[![wheel](https://img.shields.io/pypi/wheel/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n[![format](https://img.shields.io/pypi/format/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n[![implementation](https://img.shields.io/pypi/implementation/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n[![LICENSE](https://img.shields.io/pypi/l/kalyke-apns.svg)](https://pypi.org/project/kalyke-apns)\n\nA library for interacting with APNs and VoIP using HTTP/2.\n\n## Installation\n\nkalyke requires python 3.9 or later.\n\n```bash\n$ pip install kalyke-apns\n```\n\n## Usage\n\n### APNs\n\n```python\nimport asyncio\n\nfrom kalyke import ApnsClient, ApnsConfig, Payload, PayloadAlert\n\nclient = ApnsClient(\n use_sandbox=True,\n team_id=\"YOUR_TEAM_ID\",\n auth_key_id=\"AUTH_KEY_ID\",\n auth_key_filepath=\"/path/to/AuthKey_AUTH_KEY_ID.p8\",\n)\n\nregistration_id = \"a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500\"\n\npayload_alert = PayloadAlert(title=\"YOUR TITLE\", body=\"YOUR BODY\")\npayload = Payload(alert=payload_alert, badge=1, sound=\"default\")\nconfig = ApnsConfig(topic=\"com.example.App\")\n\nasyncio.run(\n client.send_message(\n device_token=registration_id,\n payload=payload,\n apns_config=config,\n )\n)\n```\n\n### LiveActivity\n\n> [!NOTE]\n> - The topic suffix must be `.push-type.liveactivity`.\n> - `LiveActivityPayload.event` default value is `LiveActivityEvent.UPDATE`.\n\n```python\nimport asyncio\nfrom datetime import datetime\n\nfrom kalyke import LiveActivityClient, LiveActivityApnsConfig, LiveActivityEvent, LiveActivityPayload, PayloadAlert\n\nclient = LiveActivityClient(\n use_sandbox=True,\n team_id=\"YOUR_TEAM_ID\",\n auth_key_id=\"AUTH_KEY_ID\",\n auth_key_filepath=\"/path/to/AuthKey_AUTH_KEY_ID.p8\",\n)\n\nregistration_id = \"a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500\"\n\npayload_alert = PayloadAlert(title=\"YOUR TITLE\", body=\"YOUR BODY\")\npayload = LiveActivityPayload(\n alert=payload_alert,\n badge=1,\n sound=\"default\",\n timestamp=datetime.now(),\n event=LiveActivityEvent.UPDATE,\n content_state={\n \"currentHealthLevel\": 100,\n \"eventDescription\": \"Adventure has begun!\",\n },\n)\nconfig = LiveActivityApnsConfig(\n topic=\"com.example.App.push-type.liveactivity\",\n)\n\nasyncio.run(\n client.send_message(\n device_token=registration_id,\n payload=payload,\n apns_config=config,\n )\n)\n```\n\n### VoIP\n\n> [!NOTE]\n> - The topic suffix must be `.voip`.\n\n```python\nimport asyncio\nfrom pathlib import Path\n\nfrom kalyke import VoIPApnsConfig, VoIPClient\n\nclient = VoIPClient(\n use_sandbox=True,\n auth_key_filepath=Path(\"/\") / \"path\" / \"to\" / \"YOUR_VOIP_CERTIFICATE.pem\",\n)\n\nregistration_id = \"a8a799ba6c21e0795b07b577b562b8537418570c0fb8f7a64dca5a86a5a3b500\"\n\npayload = {\"key\": \"value\"}\nconfig = VoIPApnsConfig(\n topic=\"com.example.App.voip\",\n)\n\nasyncio.run(\n client.send_message(\n device_token=registration_id,\n payload=payload,\n apns_config=config,\n )\n)\n```\n\n## License\n\nThis software is licensed under the MIT License (See [LICENSE](LICENSE)).\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A library for interacting with APNs and VoIP using HTTP/2.",
"version": "1.0.5",
"project_urls": {
"Homepage": "https://github.com/nnsnodnb/kalyke",
"Repository": "https://github.com/nnsnodnb/kalyke"
},
"split_keywords": [
"apns",
" voip",
" liveactivity",
" apns provider api",
" apple push notifications"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a0db9af6ee81f9b46258fd079ab1e3639d55b328a23be2bc7d13a8e35bb7f8b9",
"md5": "84cf0f50ea4d1b33219ebdd83275437f",
"sha256": "1575da376ea66d8cb8c746cdfb3e3bcab5474ad55164d6d9efd7bc4e1652a2f9"
},
"downloads": -1,
"filename": "kalyke_apns-1.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "84cf0f50ea4d1b33219ebdd83275437f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.9",
"size": 13430,
"upload_time": "2024-10-11T10:42:45",
"upload_time_iso_8601": "2024-10-11T10:42:45.395320Z",
"url": "https://files.pythonhosted.org/packages/a0/db/9af6ee81f9b46258fd079ab1e3639d55b328a23be2bc7d13a8e35bb7f8b9/kalyke_apns-1.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "99d38e528a5d591c7fef9339b1822094e480c466e99bf0957d821e8dc3cdb68d",
"md5": "fdcd5cc5b246cf2e33e701f78e09f960",
"sha256": "dc3ee5742275dcdacd4373ebdfef07a927a86f8bb311f695fad46a5d64d5bb31"
},
"downloads": -1,
"filename": "kalyke_apns-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "fdcd5cc5b246cf2e33e701f78e09f960",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.9",
"size": 9993,
"upload_time": "2024-10-11T10:42:46",
"upload_time_iso_8601": "2024-10-11T10:42:46.723669Z",
"url": "https://files.pythonhosted.org/packages/99/d3/8e528a5d591c7fef9339b1822094e480c466e99bf0957d821e8dc3cdb68d/kalyke_apns-1.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-11 10:42:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nnsnodnb",
"github_project": "kalyke",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"lcname": "kalyke-apns"
}