Skip to main content

Python package for using Urban Airship Connect

Project description

About

uaconnect is a Python library for using the Urban Airship Connect API for streaming mobile event data to your application.

Requirements

Tested on Python 2.7 and 3.5, and should work with 3.3+.

Usage

See the Connect Getting Started Guide, as well as the Connect API for more details.

Basic usage

To use the library, instantiate a Consumer object with the application key, access token, and an offset recorder. You can then open the connection, and start reading events.

>>> import uaconnect
>>> consumer = uaconnect.Consumer(
...     'application_key', 'access_token',
...     uaconnect.FileRecorder('.offset'))
>>> consumer.connect()
>>> for event in consumer.read():
...     if event is None:
...        continue
>>>     print("Got event: {}".format(event))
>>>     consumer.ack(event)

Offset recorders

Offset recorders inherit from the abstract base class uaconnect.Recorder, implementing read_offset and write_offset methods. One recorder is included in the library, FileRecorder, which stores the offest on disk. In the uaconnect.ext.redisrecorder package there is an example implementation of using an Redis instance to store the offset.

ack calls should be placed depending on whether in a failure scenario your app wishes to possibly replay an already handled event, or risk dropping one. For the latter, call ack as soon as the event is read; for the former, call ack only after the event has been fully handled.

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

uaconnect-0.1.tar.gz (6.1 kB view details)

Uploaded Source

File details

Details for the file uaconnect-0.1.tar.gz.

File metadata

  • Download URL: uaconnect-0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for uaconnect-0.1.tar.gz
Algorithm Hash digest
SHA256 8b6e0386593e3415d5d69d2ae93c009b34b11101945ce3f5cb34bd4ef3bfcea7
MD5 597abe46365f9d38b73a1ff0fbdb7a35
BLAKE2b-256 3afea8a152170ed543c3f01b0b2e2f1c33537ae88273dcea3335f9c5763e3a0a

See more details on using hashes here.

Provenance

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