pyAPNsKit
Send requests to Apple Push Notification service (APNs) to push notifications to users via HTTP/2, token-based
pip install pyAPNsKit
Get Started
Quickly push notifications to devices (async, batch supported)
import asyncio
from pyAPNsKit import apns
p8key = ""
with open('AuthKey_KeyID.p8', 'r') as p8file:
p8key = p8file.read()
client = apns.Client("teamID", "topic", "KeyID", p8key, isSandbox=False)
async def main():
responses = await client.sendAlert(
["deviceToken1", "deviceToken2"], # support batch
"title",
"subtitle",
"message",
sound=True,
apns_collapse_id="Collapse"
)
for resp in responses:
print(resp.isSuccess, resp.status_code, resp.reason, resp.apns_id)
asyncio.run(main())
[!NOTE]
For parameters, their acquisition methods, and instructions, please refer to the Apple Developer Document
Customized
import asyncio
from pyAPNsKit import apns, APNsHeader, APNsBody, types
p8key = ""
with open('AuthKey_KeyID.p8', 'r') as p8file:
p8key = p8file.read()
header = APNsHeader.APNsHeader(
teamID="teamID",
topic="topic",
keyID="KeyID",
p8Key=p8key,
pushType=types.PushType.alert,
apns_collapse_id="Collapse"
)
body = APNsBody.APNsBody().withAlert(
title="title",
subtitle="sub",
message="message"
).withSound().withBadge(1)
async def main():
responses = await apns.asyncPushByDeviceTokens(
["deviceToken1", "deviceToken2"],
header,
body,
isSandbox=False
)
for resp in responses:
print(resp.isSuccess, resp.status_code, resp.reason, resp.apns_id)
asyncio.run(main())
Release files for pyAPNsKit 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyapnskit-0.2.1.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyapnskit-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.5 kB
Release files / pyapnskit-0.2.1.tar.gz
| Download URL | pyapnskit-0.2.1.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
283c0fbe06d8bff92753421505f064d50c875c98b4036b7565a37e0b4a234377
|
|
BLAKE2b-256 checksum How to use checksums |
1da301ed662f8f76e6668da72cd9f0db3a08ba96ca9e93999814141838a57a27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency logRelease files / pyapnskit-0.2.1-py3-none-any.whl
| Download URL | pyapnskit-0.2.1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af677c25b8926193354b60968b345e762aeed3e74eddd1ce03503b38f73de5f9
|
|
BLAKE2b-256 checksum How to use checksums |
a43cce2d75901e23974148a38e457033b56da49d027471564bbce306cd8c1088
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 15, 2026.
Transparency log