跳转到主要内容

异步Apple推送通知服务客户端

项目描述

AAPNS

CircleCI Documentation Status

异步苹果推送通知服务客户端。

  • 需要 TLS 1.2 或更高版本
  • 需要 Python 3.8 或更高版本

快速入门

from aapns.api import Server
from aapns.config import Priority
from aapns.models import Notification, Alert, Localized

async def send_hello_world():
    client = await Server.production('/path/to/push/cert.pem').create_client()
    apns_id = await client.send_notification(
        'my-device-token',
        Notification(
            alert=Alert(
                body=Localized(
                    key='Hello World!',
                    args=['foo', 'bar']
                ),
            ),
            badge=42
        ),
        priority=Priority.immediately
    )
    print(f'Sent push notification with ID {apns_id}')
    await client.close()

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

aapns-23.7.tar.gz (14.3 kB 查看哈希值)

上传时间

构建分布

aapns-23.7-py3-none-any.whl (16.7 kB 查看哈希值)

上传时间 Python 3

由以下支持