Skip to main content

Unofficial Pushed.co API wrapper

Project description

https://travis-ci.org/digmore/pypushed.svg?branch=master https://coveralls.io/repos/github/digmore/pypushed/badge.svg?branch=master https://img.shields.io/pypi/v/pushed.svg

Overview

Python wrapper for the pushed.co API. https://pushed.co

Send push notifications to mobile devices without writing your own mobile app. Have notifications pushed to you rather than relying on polling RSS feeds and the like.

Usage

Currently only the push functionality and some of the OAuth2 is implemented here.

Basic usage:

import pushed

APP_KEY = 'MY_PUSHED_APP_KEY'
APP_SECRET = 'MY_PUSHED_APP_SECRET'
CHANNEL_ALIAS = 'MY_CHANNEL_ALIAS'
PUSHED_ID = 'PUSHED_ID_FOR_SUBSCRIBER'

p = pushed.Pushed(APP_KEY, APP_SECRET)

# Push message to your application's subscribers
shipment = p.push_app('test app push')

# Push message to your channel's subscribers
shipment = p.push_channel('test channel push', CHANNEL_ALIAS)

# Push message to a user by Pushed ID
shipment = p.push_pushed_id('test Pushed ID push', PUSHED_ID)

# Push URL enriched message to your application's subscribers
shipment =  p.push_app('test app push', content_url='http://example.com')

Pushing to a user requires an OAuth2 access token. You must swap a temporary code for this access token using the Pushed API. These temporary codes arrive by webhook, when a subscriber follows your authorization link and agrees to the access.

To generate an authorization link to share with your users:

p = pushed.Pushed(APP_KEY, APP_SECRET)
uri = p.authorization_link('https://example.org/my-webhook-handler')

Using a code to get an access token, then sending a message to the user:

p = pushed.Pushed(APP_KEY, APP_SECRET)
access_token = p.access_token(temporary_code)
shipment = p.push_user('test user push', access_token)

All four push methods return an alphanumeric Shipment ID which you can check against your Pushed.co control panel. If the Pushed API returns a JSON failure message then a PushedAPIError will be raised using its type and message fields.

The content_url parameter is optional and is supported by all push types. It allows you to enrich your messages with a hyperlink if desired.

Installation

Using pip

pip install pushed

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

pushed-0.1.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

pushed-0.1.4-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pushed-0.1.4.tar.gz.

File metadata

  • Download URL: pushed-0.1.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pushed-0.1.4.tar.gz
Algorithm Hash digest
SHA256 ed1a9c4872579e3d7cb0b9be4b06d65af9ca57c997242a5fb69121b4880c849a
MD5 278c81db6c407bbe5ece9f0a441f3177
BLAKE2b-256 92003efd65d0791e36fc27afa9744961f3fbc6fa57f09d19388322caa2df0b3a

See more details on using hashes here.

File details

Details for the file pushed-0.1.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pushed-0.1.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0c4d9299bbe9239b39b374a2f63b36cf11f32da9debc0d107e91a1608bea4f97
MD5 92c736cd9d02b93a50c1c28b245e734b
BLAKE2b-256 e7e818a1136940244006c6d9ad0061664cdd9bb7a7d8e02dbfb2d1915ce1b72e

See more details on using hashes here.

Supported by

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