Skip to main content

Pusher Push Notifications Python server SDK

Project description

https://travis-ci.org/pusher/push-notifications-python.svg?branch=master

Pusher Beams Python server SDK

Full documentation for this SDK can be found here

Installation

The Pusher Beams Python server SDK is available on PyPi here.

You can install this SDK by using pip:

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

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 Beams PushNotifications instance you can publish a push notification to your registered & subscribed devices:

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

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-1.0.3.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

pusher_push_notifications-1.0.3-py2.py3-none-any.whl (4.8 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