Install & Compatibility
Where this runs
tested against v7.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.747s · 22.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.3s · import 0.653s · 23MB
21MB installed
● package 21MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BasicAuthClient
✓ from urbanairship import BasicAuthClient
BearerTokenAuthClient
✓ from urbanairship import BearerTokenAuthClient
Airship
✓ N/A (removed in v7.0.0)
✗ from urbanairship import Airship
The `Airship` class was removed in v7.0.0. Use `BasicAuthClient` or `BearerTokenAuthClient` instead.
Push
✓ from urbanairship import Push
Audience
✓ from urbanairship import Audience
Notification
✓ from urbanairship import Notification
Platform
✓ from urbanairship import Platform
This quickstart demonstrates how to send a basic push notification to all devices using `BasicAuthClient`, which is the recommended client for key/secret authentication. Ensure your Airship App Key and Master Secret are configured either as environment variables or directly in the code (for development purposes).
import os
from urbanairship import BasicAuthClient, Push, Audience, Notification, Platform
# Replace with your actual credentials or set as environment variables
APP_KEY = os.environ.get('URBAN_AIRSHIP_APP_KEY', 'YOUR_APP_KEY')
MASTER_SECRET = os.environ.get('URBAN_AIRSHIP_MASTER_SECRET', 'YOUR_MASTER_SECRET')
if APP_KEY == 'YOUR_APP_KEY' or MASTER_SECRET == 'YOUR_MASTER_SECRET':
print("Please set URBAN_AIRSHIP_APP_KEY and URBAN_AIRSHIP_MASTER_SECRET environment variables or replace placeholders.")
# exit(1) # Uncomment to prevent execution with dummy credentials
# Initialize the client with Basic Authentication
client = BasicAuthClient(APP_KEY, MASTER_SECRET)
try:
# Create a Push object
push = Push(client)
# Target all devices
push.audience = Audience.all()
# Define the notification message
push.notification = Notification(alert="Hello from Urban Airship Python Library!")
# Specify device types (platforms) to target
push.device_types = Platform.all()
# Send the push notification
response = push.send()
print(f"Push notification sent successfully! Status: {response.status_code}")
print(f"Response body: {response.json()}")
except Exception as e:
print(f"An error occurred: {e}")
Errors
Common errors & fixes
AttributeError: module 'urbanairship' has no attribute 'Airship'
Attempting to use the `Airship` client class in `urbanairship` versions 7.0.0 or newer. This class was removed.
fixReplace `urbanairship.Airship(key, secret)` with `urbanairship.BasicAuthClient(key, secret)` or `urbanairship.BearerTokenAuthClient(token)`.
TypeError: 'int' object is not subscriptable
In `urbanairship` versions before 7.3.1, sending a `message` without a `notification` could improperly raise a `TypeError`.
fixUpgrade to `urbanairship` version 7.3.1 or newer. If upgrading is not possible, ensure that when sending a `message`, a `notification` object is also included or structure your payload appropriately to avoid this edge case.
ImportError: cannot import name 'Airship' from 'urbanairship'
Attempting to import the `Airship` client class directly from the `urbanairship` package in versions 7.0.0 or newer. This class no longer exists.
fixChange your import statement from `from urbanairship import Airship` to `from urbanairship import BasicAuthClient` or `from urbanairship import BearerTokenAuthClient`.
Upgrade
Version history
7.3.2latest on PyPI · released Jun 12, 2026
Audit
Dependencies
requestsrequiredHTTP client for API requests
pytzrequiredTime zone handling
iso8601requiredISO 8601 date parsing
python-dateutilrequiredExtends datetime functionality