Skip to main content

Pusher Push Notifications Python server SDK

Project description

https://travis-ci.org/pusher/push-notifications-python.svg?branch=master https://codecov.io/gh/pusher/push-notifications-python/branch/master/graph/badge.svg

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


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-2.0.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pusher_push_notifications-2.0.0-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pusher_push_notifications-2.0.0.tar.gz.

File metadata

  • Download URL: pusher_push_notifications-2.0.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for pusher_push_notifications-2.0.0.tar.gz
Algorithm Hash digest
SHA256 d10050919abce24cf5242e21d4859aa9cf7698ab5740aeb1bb75300e4dd84e58
MD5 7ab83d0ac59a14b1f277a7cbf4ae5760
BLAKE2b-256 e50bdf0e1a306942962ffcc49a6555d11b6dd81289afee831b5f2129dbeba353

See more details on using hashes here.

File details

Details for the file pusher_push_notifications-2.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pusher_push_notifications-2.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.39.0 CPython/3.7.3

File hashes

Hashes for pusher_push_notifications-2.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ccf467cc89e130a9dcbff8f6743c48118a07085b9f16cfb10c2f15dbc2ddf2d2
MD5 b9604e1744640b9d2fb32b83b8db285e
BLAKE2b-256 02d18d5a222c748ce43dbb2d56997f3a9304d674d108380cd721b11a611d4cba

See more details on using hashes here.

Supported by

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