Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
pusher-push-notifications
Advanced tools
.. 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
Full documentation for this SDK can be found here <https://docs.pusher.com/beams/reference/server-sdk-python>
__
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
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'])
FAQs
Pusher Push Notifications Python server SDK
We found that pusher-push-notifications demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.