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'])
===========================================
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pusher_push_notifications-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a1de3ff7e8768d195524ad98511651a0f07972f5319fa761a3fd89995b55b4 |
|
MD5 | 1ed1f60f04251aa6e72897b3eabb1d20 |
|
BLAKE2b-256 | 33c85d20b9cdd144bac8800eaee4a00687d7b4e5368d295ec266ca10fe3cc879 |
Close
Hashes for pusher_push_notifications-0.9.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aefcc8180c0df816b8ae1f7fa541698243763717fe23328ccb6fc9a160d75fe |
|
MD5 | 7b6f34d2149585b8fe153cc97c218e5e |
|
BLAKE2b-256 | 8b44d6ccfc1ffce9da3c2c5dddc36c8d000c0a9630aba14831452f13b3ebe7fc |