Pusher Push Notifications Python server SDK
Project description
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
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:
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:
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'])
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-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69fc3f56913aea0ad04999f5963c3c20894877af6c19a736cbc911dce0d5788d |
|
MD5 | 31ba01fd498b9fccf554737269425629 |
|
BLAKE2b-256 | 2929ebe4434ac6512000fc58a7d03641717e6d1f8a8289e31da24d9661c27b27 |
Close
Hashes for pusher_push_notifications-2.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78a2945e9b4430c43a5dde0f9b15b6008394b86903739ee4968ee339f67d4b7a |
|
MD5 | c75d6cee009da2c8ad9694cd40495e82 |
|
BLAKE2b-256 | b0283d9e88ae3e178eb66e5d017fda2bd23237f65087554e39c863f0c9f604bd |