aioapns


Nameaioapns JSON
Version 3.3.1 PyPI version JSON
download
home_pagehttps://github.com/Fatal1ty/aioapns
SummaryAn efficient APNs Client Library for Python/asyncio
upload_time2024-07-05 16:01:26
maintainerNone
docs_urlNone
authorAlexander Tikhonov
requires_pythonNone
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.8 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
* Support for basic HTTP-Proxies


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": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Alexander Tikhonov",
    "author_email": "random.gauss@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/2a/c7/4fcc1892bc27ed464bc5893617a9366f4868c3db8aa9330f220176e8f4d8/aioapns-3.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.8 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* Support for basic HTTP-Proxies\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",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "An efficient APNs Client Library for Python/asyncio",
    "version": "3.3.1",
    "project_urls": {
        "Homepage": "https://github.com/Fatal1ty/aioapns"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "78dca20f4dbfb3fe4a968a1394ef31285c9873efc741c953cd155859f07cbb06",
                "md5": "f9b58880c976f055cfe1140322da5ed7",
                "sha256": "4227fe47e967e6e18cbe283dfcbd8d05b739f1e71ab05ff3f8f21a959252fc9c"
            },
            "downloads": -1,
            "filename": "aioapns-3.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f9b58880c976f055cfe1140322da5ed7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14598,
            "upload_time": "2024-07-05T16:01:19",
            "upload_time_iso_8601": "2024-07-05T16:01:19.021947Z",
            "url": "https://files.pythonhosted.org/packages/78/dc/a20f4dbfb3fe4a968a1394ef31285c9873efc741c953cd155859f07cbb06/aioapns-3.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ac74fcc1892bc27ed464bc5893617a9366f4868c3db8aa9330f220176e8f4d8",
                "md5": "6cf7a0f4e80451a29a72ecc8dd236236",
                "sha256": "6df429729fe8101a45bbdcb0a20f0214618747c67990bea5d8eda7cd95da37dd"
            },
            "downloads": -1,
            "filename": "aioapns-3.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6cf7a0f4e80451a29a72ecc8dd236236",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14300,
            "upload_time": "2024-07-05T16:01:26",
            "upload_time_iso_8601": "2024-07-05T16:01:26.136013Z",
            "url": "https://files.pythonhosted.org/packages/2a/c7/4fcc1892bc27ed464bc5893617a9366f4868c3db8aa9330f220176e8f4d8/aioapns-3.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 16:01:26",
    "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.28228s