# Airship Python Library

Python library for using Airship's messaging platform and related features.
## Resources

- [GitHub Repo](https://github.com/urbanairship/python-library/)
- [Python Package Index (PyPI)](https://pypi.python.org/pypi/urbanairship)
- [Airship API Reference](https://www.airship.com/docs/developer/rest-api/ua/)
- [Python Library API Reference](https://www.airship.com/docs/reference/libraries/python/latest)

## Installation

Using `pip`:

```bash
pip install urbanairship
```


## Using the library

The library is intended to be used with the small footprint of a single
import.

To get started, import the package, and create an `Airship` object representing a single Airship application:

```python
import urbanairship as ua
client = ua.BasicAuthClient('<app key>', '<master secret>')

push = ua.Push(client)
push.audience = ua.ios_channel('074e84a2-9ed9-4eee-9ca4-cc597bfdbef3')
push.notification = ua.notification(ios=ua.ios(alert='Hello from Python', badge=1))
push.device_types = ua.device_types('ios')
push.send()
```


The library uses [Requests](https://requests.kennethreitz.org/en/master/) for communication with the Airship API,
providing connection pooling and strict SSL checking. The `Airship`
object is threadsafe and can be instantiated once and reused in multiple threads.

## Logging

`urbanairship` uses the standard logging module for integration into
an application's existing logging. If you do not have logging
configured otherwise, set it up in your application.

**Set up logging**

```python
import logging
logging.basicConfig()
```


If you're having trouble with the Airship API, you can turn on verbose debug
logging.

**Turn on verbose logging**

```python
logging.getLogger('urbanairship').setLevel(logging.DEBUG)
```


As of Python 2.7, `DeprecationWarning` warnings are silenced by
default. To enable them, use the `warnings` module.

**Turn on deprecation warnings**

```python
import warnings
warnings.simplefilter('default')
```

