Skip to main content

pyopensky

The pyopensky Python library provides functions to download data from the OpenSky Network live API and historical databases. It aims at making ADS-B and Mode S data from OpenSky easily accessible in the Python programming environment.

Key features:

  • Access to live aircraft state vectors and flight information via REST API
  • Query historical ADS-B and Mode S data from the Trino database
  • Decode and rebuild flight trajectories from raw messages
  • Support for spatial and temporal filtering
  • Built-in caching for efficient data retrieval
  • Integration with pandas DataFrames for easy data analysis

Full documentation on https://mode-s.org/pyopensky/

Installation

pip install pyopensky

or add it in your project with

uv add pyopensky

The library is also available on conda-forge, although this approach is no longer recommended:

conda install -c conda-forge pyopensky

Credentials

Access to the OpenSky Network historical database requires authentication. See details in the documentation on how to:

  • Apply an OpenSky Network account
  • Configure your credentials for API access
  • Set up authentication for the Trino database

Usage

1. REST API

Access live and recent flight data.

Functions

from pyopensky.rest import REST

rest = REST()

rest.states()
rest.tracks(icao24)
rest.routes(callsign)
rest.aircraft(icao24, begin, end)
rest.arrival(airport, begin, end)
rest.departure(airport, begin, end)

Examples

from pyopensky.rest import REST

rest = REST()

# Get current state vectors for all aircraft
rest.states()

# Get trajectory for a specific aircraft
rest.tracks(icao24="3c6444")

# Get route information for a callsign
rest.routes(callsign="AFR292")

# Get flights for a specific aircraft in a time range
# NOTE: do NOT use REST for historical data, use trino instead!!
rest.aircraft(icao24="3c6444", begin="2024-01-01", end="2024-01-02")

# Get arrivals at an airport
# NOTE: do NOT use REST for historical data, use trino instead!!
rest.arrival(airport="EHAM", begin="2024-01-01 12:00", end="2024-01-01 13:00")

# Get departures from an airport
# NOTE: do NOT use REST for historical data, use trino instead!!
rest.departure(airport="LFPG", begin="2024-01-01 12:00", end="2024-01-01 13:00")

2. Trino Interface

Query historical ADS-B and Mode S data with advanced selection and processing.

Functions

from pyopensky.trino import Trino

trino = Trino()
# full description of the whole set of parameters in the documentation
trino.flightlist(start, stop, *, airport, callsign, icao24)
trino.rawdata(start, stop, *, callsign, icao24, bounds)
trino.history(start, stop, *, callsign, icao24, bounds)
trino.rebuild(start, stop, *, icao24, bounds)

For several routes in the same time window, use one query with exact directed airport pairs:

df = trino.history(
    "2025-01-01",
    "2025-01-02",
    routes=[("KJFK", "EGLL"), ("KMIA", "EIDW"), ("LFPG", "KJFK")],
    selected_columns=("time", "icao24", "callsign", "lat", "lon"),
)

The same routes filter is available in flightlist() for metadata queries and rawdata() for raw messages. history() clips trajectories to the requested time window, including flights that cross midnight.

Optional Trino session settings apply to all queries on a client. For selective flight joins whose filtered flight table fits in each worker's memory:

trino = Trino(session_properties={"join_distribution_type": "BROADCAST"})

Trino() uses the server's default settings. Use cached=False on each call when benchmarking query performance.

Metadata

Release files for pyopensky 2.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyopensky 2.18
File Size Uploaded Provenance Actions
pyopensky-2.18.tar.gz 363.0 kB Without provenance Details for pyopensky-2.18.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyopensky 2.18
File Interpreter ABI Platform Actions
pyopensky-2.18-py3-none-any.whl Python 3 none any Details for pyopensky-2.18-py3-none-any.whl

Total release size: 397.6 kB

Release files / pyopensky-2.18.tar.gz

Download URL pyopensky-2.18.tar.gz
Size 363.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5cd8aec9b2d71c7dacc25ae47c86821acd84d2c893f01d9e2c8d3248bced466b
BLAKE2b-256 checksum
How to use checksums
4e665ca8ec8a46b5d379f779e83cd580632962a8aa1910c285b4bd3dd8b0262a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pyopensky-2.18-py3-none-any.whl

Download URL pyopensky-2.18-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fd4f66175f157f46bb2d1f5677e0aa06527cd11b16f0a176346228ed84f78d7
BLAKE2b-256 checksum
How to use checksums
de09eed3acf10e89e646595c1492cc06491d56b480621a96d3a148f00ecaacce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pyopensky 2.18

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page