aioapns


Nameaioapns JSON
Version 3.1 PyPI version JSON
download
home_pagehttps://github.com/Fatal1ty/aioapns
SummaryAn efficient APNs Client Library for Python/asyncio
upload_time2023-10-23 12:05:07
maintainer
docs_urlNone
authorAlexander Tikhonov
requires_python
licenseApache License, Version 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            aioapns - An efficient APNs Client Library for Python/asyncio
=================================================================================

.. image:: https://github.com/Fatal1ty/aioapns/workflows/tests/badge.svg
   :target: https://github.com/Fatal1ty/aioapns/actions

.. image:: https://img.shields.io/pypi/v/aioapns.svg
    :target: https://pypi.python.org/pypi/aioapns

.. image:: https://img.shields.io/pypi/pyversions/aioapns.svg
    :target: https://pypi.python.org/pypi/aioapns/

.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg
    :target: https://opensource.org/licenses/Apache-2.0

**aioapns** is a library designed specifically for sending push-notifications to iOS devices
via Apple Push Notification Service. aioapns provides an efficient client through
asynchronous HTTP2 protocol for use with Python's ``asyncio``
framework.

aioapns requires Python 3.6 or later.


Performance
-----------

In my testing aioapns allows you to send on average 1.3k notifications per second on a single core.


Features
--------

* Internal connection pool which adapts to the current load
* Support for certificate and token based connections
* Ability to set TTL (time to live) for notifications
* Ability to set priority for notifications
* Ability to set collapse-key for notifications
* Ability to use production or development APNs server


Installation
------------

Use pip to install::

    $ pip install aioapns


Basic Usage
-----------

.. code-block:: python

    import asyncio
    from uuid import uuid4
    from aioapns import APNs, NotificationRequest, PushType


    async def run():
        apns_cert_client = APNs(
            client_cert='/path/to/apns-cert.pem',
            use_sandbox=False,
        )
        apns_key_client = APNs(
            key='/path/to/apns-key.p8',
            key_id='<KEY_ID>',
            team_id='<TEAM_ID>',
            topic='<APNS_TOPIC>',  # Bundle ID
            use_sandbox=False,
        )
        request = NotificationRequest(
            device_token='<DEVICE_TOKEN>',
            message = {
                "aps": {
                    "alert": "Hello from APNs",
                    "badge": "1",
                }
            },
            notification_id=str(uuid4()),  # optional
            time_to_live=3,                # optional
            push_type=PushType.ALERT,      # optional
        )
        await apns_cert_client.send_notification(request)
        await apns_key_client.send_notification(request)

    loop = asyncio.get_event_loop()
    loop.run_until_complete(run())


License
-------

aioapns is developed and distributed under the Apache 2.0 license.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Fatal1ty/aioapns",
    "name": "aioapns",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Alexander Tikhonov",
    "author_email": "random.gauss@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/bf/45b7028ed859ba4345329115a9f7eac8b8149d858a5038b7e0cd149704ba/aioapns-3.1.tar.gz",
    "platform": "all",
    "description": "aioapns - An efficient APNs Client Library for Python/asyncio\n=================================================================================\n\n.. image:: https://github.com/Fatal1ty/aioapns/workflows/tests/badge.svg\n   :target: https://github.com/Fatal1ty/aioapns/actions\n\n.. image:: https://img.shields.io/pypi/v/aioapns.svg\n    :target: https://pypi.python.org/pypi/aioapns\n\n.. image:: https://img.shields.io/pypi/pyversions/aioapns.svg\n    :target: https://pypi.python.org/pypi/aioapns/\n\n.. image:: https://img.shields.io/badge/License-Apache%202.0-blue.svg\n    :target: https://opensource.org/licenses/Apache-2.0\n\n**aioapns** is a library designed specifically for sending push-notifications to iOS devices\nvia Apple Push Notification Service. aioapns provides an efficient client through\nasynchronous HTTP2 protocol for use with Python's ``asyncio``\nframework.\n\naioapns requires Python 3.6 or later.\n\n\nPerformance\n-----------\n\nIn my testing aioapns allows you to send on average 1.3k notifications per second on a single core.\n\n\nFeatures\n--------\n\n* Internal connection pool which adapts to the current load\n* Support for certificate and token based connections\n* Ability to set TTL (time to live) for notifications\n* Ability to set priority for notifications\n* Ability to set collapse-key for notifications\n* Ability to use production or development APNs server\n\n\nInstallation\n------------\n\nUse pip to install::\n\n    $ pip install aioapns\n\n\nBasic Usage\n-----------\n\n.. code-block:: python\n\n    import asyncio\n    from uuid import uuid4\n    from aioapns import APNs, NotificationRequest, PushType\n\n\n    async def run():\n        apns_cert_client = APNs(\n            client_cert='/path/to/apns-cert.pem',\n            use_sandbox=False,\n        )\n        apns_key_client = APNs(\n            key='/path/to/apns-key.p8',\n            key_id='<KEY_ID>',\n            team_id='<TEAM_ID>',\n            topic='<APNS_TOPIC>',  # Bundle ID\n            use_sandbox=False,\n        )\n        request = NotificationRequest(\n            device_token='<DEVICE_TOKEN>',\n            message = {\n                \"aps\": {\n                    \"alert\": \"Hello from APNs\",\n                    \"badge\": \"1\",\n                }\n            },\n            notification_id=str(uuid4()),  # optional\n            time_to_live=3,                # optional\n            push_type=PushType.ALERT,      # optional\n        )\n        await apns_cert_client.send_notification(request)\n        await apns_key_client.send_notification(request)\n\n    loop = asyncio.get_event_loop()\n    loop.run_until_complete(run())\n\n\nLicense\n-------\n\naioapns is developed and distributed under the Apache 2.0 license.\n\n\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "An efficient APNs Client Library for Python/asyncio",
    "version": "3.1",
    "project_urls": {
        "Homepage": "https://github.com/Fatal1ty/aioapns"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "217dd8dfaf16b4814f0afd86f19197b3cb0d187db763dc0293ed40f45457d076",
                "md5": "9f0c16d82543ba32bd6d00fe75c0f206",
                "sha256": "6220827c156be7f7aceb40cc388b0129c6a33221b06cc73399b39a7d2997c338"
            },
            "downloads": -1,
            "filename": "aioapns-3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f0c16d82543ba32bd6d00fe75c0f206",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 13680,
            "upload_time": "2023-10-23T12:05:05",
            "upload_time_iso_8601": "2023-10-23T12:05:05.427474Z",
            "url": "https://files.pythonhosted.org/packages/21/7d/d8dfaf16b4814f0afd86f19197b3cb0d187db763dc0293ed40f45457d076/aioapns-3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2abf45b7028ed859ba4345329115a9f7eac8b8149d858a5038b7e0cd149704ba",
                "md5": "012009517fcf729cfa03b05845b69f60",
                "sha256": "0544912030317952a566d79880665990c7149fa840a357d609bb997076575215"
            },
            "downloads": -1,
            "filename": "aioapns-3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "012009517fcf729cfa03b05845b69f60",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 13471,
            "upload_time": "2023-10-23T12:05:07",
            "upload_time_iso_8601": "2023-10-23T12:05:07.131484Z",
            "url": "https://files.pythonhosted.org/packages/2a/bf/45b7028ed859ba4345329115a9f7eac8b8149d858a5038b7e0cd149704ba/aioapns-3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-23 12:05:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Fatal1ty",
    "github_project": "aioapns",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "aioapns"
}
        
Elapsed time: 0.12946s