Skip to main content

Python client for Notifire (https://notifire.dvdblk.com)

Project description

Notifire - Python client for Notifire

Build Status PyPi page link -- version

Notifire-Python is Python client used for sending Apple push notifications from your code to your iOS device with the Notifire application. Notification is sent as a HTTP request to the Notifire server through various implemented transports.

Usage

Notifire has an account management system. This allows you to preserve your data across various iOS devices. You can either create Notifire account or use 3rd party accounts (e.g. Google).
Create a service in the Notifire iOS application. Then you obtain service api key that you can either pass directly to the client class or through the environment variable NOTIFIRE_SERVICE_API_KEY.

Install notifire with pip:

pip install notifire

Create and configure a client:

from notifire import Client

client = Client('service_api_key')
client.send_notification('Hello from Python')

Notification

The notification consists of

  • body (required) - title of the iOS notification pop-up
  • level - one of info/error/warning to filter the notification
  • text - additional text of the notification shown in notification tab
  • url - url displayed in the notification

These parameters are accepted bysend_notification method. Notifications are aggregated under a service which you create in the Notifire iOS application.
Service is a representation of your code/script/application from which you send these notifications.

Transports

A transport is the mechanism through which Notifire sends the HTTP request to the Notifire server. There are 6 types of transports implemented:

  • AioHttpTransport - should be used in asyncio based environments
  • GeventedHTTPTransport - should be used in gevent based environments
  • HTTPTransport - synchronous blocking transport, can be used in any environment
  • RequestsHTTPTransport - synchronous blocking transport using requests library, can be used in any environment
  • ThreadedHTTPTransport (Default) - spawns a thread (async worker) that is processing messages
  • ThreadedRequestsHTTPTransport - spawns a thread (async worker) that is using requests library for processing messages

To use your desired transport, simply import and pass it to the Client class.

from notifire import Client
from notifire.transport import ThreadedHTTPTransport

client = Client('service_api_key', transport=ThreadedHTTPTransport)

Integrations

You can use Notifire with the legacy Sentry python client Raven. This will allow you to receive errors to Notifire as well as to Sentry.

Install notifire and raven from pip:

pip install notifire[raven]

Create and configure a client which serves as both Notifire and Sentry client:

from notifire.integrations.raven import Client

client = Client(service_api_key='service_api_key',
                sentry_dsn='__DSN__')

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

notifire-0.1.0.tar.gz (19.4 kB view hashes)

Uploaded Source

Built Distribution

notifire-0.1.0-py3-none-any.whl (19.7 kB view hashes)

Uploaded 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