Skip to main content

Pusher Push Notifications Python server SDK

Project description

Pusher Push Notifications Python server SDK
===========================================
Full documentation for this SDK can be found `here <https://docs.pusher.com/push-notifications/reference/server-sdk-python>`_

Installation
------------
The Pusher Notifications 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:: bash

$ 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>`_) to create a PushNotifications instance:

.. code:: python

from pusher_push_notifications import PushNotifications

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

Publishing a Notification
~~~~~~~~~~~~~~~~~~~~~~~~~

Once you have created your PushNotifications instance you can publish a push notification to your registered & subscribed devices:

.. code:: python

response = pn_client.publish(interests=['hello'], publish_body={'apns': {'aps': {'alert': 'Hello!'}}})

print(response['publishId'])


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pusher_push_notifications-0.9.0.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

pusher_push_notifications-0.9.0-py2.py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page