pusher-push-notifications


Namepusher-push-notifications JSON
Version 2.0.2 PyPI version JSON
download
home_pageNone
SummaryPusher Push Notifications Python server SDK
upload_time2025-01-06 17:14:55
maintainerNone
docs_urlNone
authorPusher
requires_python!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://github.com/pusher/push-notifications-python/workflows/CI/badge.svg
   :target: https://github.com/pusher/push-notifications-python/actions?query=branch%3Amaster
.. image:: https://codecov.io/gh/pusher/push-notifications-python/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/pusher/push-notifications-python

Pusher Beams Python server SDK
==============================
Full documentation for this SDK can be found `here <https://docs.pusher.com/beams/reference/server-sdk-python>`__

Installation
------------
The Pusher Beams Python server SDK is available on PyPi
`here <https://pypi.python.org/pypi/pusher_push_notifications/>`__.

You can install this SDK by using
`pip <https://pip.pypa.io/en/stable/installing/>`__:

.. code::

    $ pip install pusher_push_notifications


Usage
-----

Configuring the SDK for Your Instance
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use your instance id and secret (you can get these from the
`dashboard <https://dash.pusher.com/beams>`__) to create a Beams PushNotifications instance:

.. code::

  from pusher_push_notifications import PushNotifications

  beams_client = PushNotifications(
      instance_id='YOUR_INSTANCE_ID_HERE',
      secret_key='YOUR_SECRET_KEY_HERE',
  )

Publishing to Device Interests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can broadcast notifications to groups of subscribed devices using `Device Interests <https://docs.pusher.com/beams/concepts/device-interests>`__:

.. code::

  response = beams_client.publish_to_interests(
      interests=['hello'],
      publish_body={
          'apns': {
              'aps': {
                  'alert': 'Hello!'
              }
          },
          'fcm': {
              'notification': {
                  'title': 'Hello',
                  'body': 'Hello, World!'
              }
          }
      }
  )

  print(response['publishId'])

Publishing to Authenticated Users
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Securely send notifications to individual users of your application using `Authenticated Users <https://docs.pusher.com/beams/concepts/authenticated-users>`__:

.. code::

  response = beams_client.publish_to_users(
      user_ids=['user-0001'],
      publish_body={
          'apns': {
              'aps': {
                  'alert': 'Hello!'
              }
          },
          'fcm': {
              'notification': {
                  'title': 'Hello',
                  'body': 'Hello, World!'
              }
          }
      }
  )

  print(response['publishId'])

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pusher-push-notifications",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Pusher",
    "author_email": "support@pusher.com",
    "download_url": "https://files.pythonhosted.org/packages/53/a6/16e3806696ab849ae2bead193f45c561e1f6edbaecabc6c80dd2816603a1/pusher_push_notifications-2.0.2.tar.gz",
    "platform": null,
    "description": ".. image:: https://github.com/pusher/push-notifications-python/workflows/CI/badge.svg\n   :target: https://github.com/pusher/push-notifications-python/actions?query=branch%3Amaster\n.. image:: https://codecov.io/gh/pusher/push-notifications-python/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/pusher/push-notifications-python\n\nPusher Beams Python server SDK\n==============================\nFull documentation for this SDK can be found `here <https://docs.pusher.com/beams/reference/server-sdk-python>`__\n\nInstallation\n------------\nThe Pusher Beams Python server SDK is available on PyPi\n`here <https://pypi.python.org/pypi/pusher_push_notifications/>`__.\n\nYou can install this SDK by using\n`pip <https://pip.pypa.io/en/stable/installing/>`__:\n\n.. code::\n\n    $ pip install pusher_push_notifications\n\n\nUsage\n-----\n\nConfiguring the SDK for Your Instance\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nUse your instance id and secret (you can get these from the\n`dashboard <https://dash.pusher.com/beams>`__) to create a Beams PushNotifications instance:\n\n.. code::\n\n  from pusher_push_notifications import PushNotifications\n\n  beams_client = PushNotifications(\n      instance_id='YOUR_INSTANCE_ID_HERE',\n      secret_key='YOUR_SECRET_KEY_HERE',\n  )\n\nPublishing to Device Interests\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou can broadcast notifications to groups of subscribed devices using `Device Interests <https://docs.pusher.com/beams/concepts/device-interests>`__:\n\n.. code::\n\n  response = beams_client.publish_to_interests(\n      interests=['hello'],\n      publish_body={\n          'apns': {\n              'aps': {\n                  'alert': 'Hello!'\n              }\n          },\n          'fcm': {\n              'notification': {\n                  'title': 'Hello',\n                  'body': 'Hello, World!'\n              }\n          }\n      }\n  )\n\n  print(response['publishId'])\n\nPublishing to Authenticated Users\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSecurely send notifications to individual users of your application using `Authenticated Users <https://docs.pusher.com/beams/concepts/authenticated-users>`__:\n\n.. code::\n\n  response = beams_client.publish_to_users(\n      user_ids=['user-0001'],\n      publish_body={\n          'apns': {\n              'aps': {\n                  'alert': 'Hello!'\n              }\n          },\n          'fcm': {\n              'notification': {\n                  'title': 'Hello',\n                  'body': 'Hello, World!'\n              }\n          }\n      }\n  )\n\n  print(response['publishId'])\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Pusher Push Notifications Python server SDK",
    "version": "2.0.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "51db3e13265d23a4131490d43ab12758a82d9b2212004bb8dd4db91e2102904c",
                "md5": "db0d64304a1bcd866df7e21fd9037a3e",
                "sha256": "abda37e8ca54b53409e1d4520a39318cdef66fb88556c509757ed7a63d4d7921"
            },
            "downloads": -1,
            "filename": "pusher_push_notifications-2.0.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "db0d64304a1bcd866df7e21fd9037a3e",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
            "size": 6447,
            "upload_time": "2025-01-06T17:14:54",
            "upload_time_iso_8601": "2025-01-06T17:14:54.610624Z",
            "url": "https://files.pythonhosted.org/packages/51/db/3e13265d23a4131490d43ab12758a82d9b2212004bb8dd4db91e2102904c/pusher_push_notifications-2.0.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "53a616e3806696ab849ae2bead193f45c561e1f6edbaecabc6c80dd2816603a1",
                "md5": "1a136b0c8cf343a70124ec7e47881c3d",
                "sha256": "6c6ef66aa0923f7c11300a60ba0a0adc4f9bd05b5b882912d47b838b5994d9d8"
            },
            "downloads": -1,
            "filename": "pusher_push_notifications-2.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1a136b0c8cf343a70124ec7e47881c3d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7",
            "size": 9114,
            "upload_time": "2025-01-06T17:14:55",
            "upload_time_iso_8601": "2025-01-06T17:14:55.786676Z",
            "url": "https://files.pythonhosted.org/packages/53/a6/16e3806696ab849ae2bead193f45c561e1f6edbaecabc6c80dd2816603a1/pusher_push_notifications-2.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-06 17:14:55",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pusher-push-notifications"
}
        
Elapsed time: 2.13027s