.. image:: https://github.com/urbanairship/python-library/actions/workflows/ci.yaml/badge.svg :target: https://github.com/urbanairship/python-library/
=====
urbanairship
is a Python library for using the Airship <http://airship.com/>
_ REST API for push notifications, message
center messages, email, and SMS.
Python 2.7, 3.6, 3.7, 3.8, or 3.9 is required. Other requirements can be found in requirements.txt.
The best place to ask questions or report a problem is our support site: http://support.airship.com/
See the full documentation for this library <https://docs.airship.com/api/libraries/python/>
, as well as the
Airship API Documentation <https://docs.airship.com/api/ua/>
.
>>> import urbanairship as ua
>>> airship = ua.Airship('application_key', 'master_secret')
>>> push = airship.create_push()
>>> push.audience = ua.or_(ua.alias('adam'), ua.ios_channel('some_ios_channel'))
>>> push.notification = ua.notification(alert='Hello')
>>> push.device_types = ua.device_types('ios')
>>> push.send()
>>> push = airship.create_push()
>>> push.audience = ua.all_
>>> push.notification = ua.notification(
... ios=ua.ios(alert='Hello iOS'),
... android=ua.android(alert='Hello Android'))
>>> push.device_types = ua.device_types('ios', 'android')
>>> push.send()
>>> import urbanairship as ua
>>> airship = ua.Airship('application_key', 'master_secret')
>>> push = airship.create_push()
>>> push.audience = ua.ios_channel('some_ios_channel')
>>> push.notification = ua.notification(alert='Hello')
>>> push.device_types = ua.device_types('ios')
>>> push.message = ua.message(
... 'Hello, message center user',
... '<html><h1>Hello!</h1><p>Goodbye.</p></html>')
>>> push.send()
>>> import urbanairship as ua
>>> airship = ua.Airship('application_key', 'master_secret')
>>> push = airship.create_push()
>>> push.audience = ua.tag('web_tag')
>>> push.notification = ua.notification(alert='Hello')
>>> push.device_types = ua.device_types('web')
>>> push.send()
See the CHANGELOG file for more details.