Skip to main content

plane-above

Plane Above

What’s flying up there, huh?

python pypi license healthcheck tests codecov ruff mypy

About

🛩 Plane Above is a Python package featuring a convenient way to retrieve planes above a given point.

One notable usage example...

Try Plane Above telegram bot. tg-bot

Before we start

To collect data, this project uses several third-party sources, including public APIs and enthusiast-maintained services. Please use them responsibly: don't push rate limits, and take care when using them so these sources remain available for everyone.

Keep in mind that returned data may be missing, incorrect, outdated, or temporarily unavailable. The project does not claim ownership of third-party data, and each source may have its own terms regarding how its data can be stored, shared, or reused. Before doing anything beyond simple lookups for educational purposes, please review the terms that apply to each source (see data sources for details).

How it works

1. BUILD SEARCHING AREA

Using the given latitude and longitude, it builds a search area by calculating bounding box coordinates based on requested distance from the point.

2. RETRIEVE STATES

Next, it makes a request to OpenSky API to retrieve states within the search area. Each state represents state vector and contains information of ADS-B messages from transponder installed in aircraft.

3. PICK DATA

After receiving the state vectors, provided that the request was successful, the rate limits were not exceeded, and at least one state was returned, it extracts the required fields and filters out irrelevant entries: for instance objects that are on ground will be discarded. At this point we already have some valuable data such as transponder hex code and flight callsign, along with reported altitude, velocity and coordinates.

4. FETCH DETAILS

Based on previous step we enrich the data by making requests to multiple sources to retrieve information about aircraft like manufacturer, model, age (based on year of manufacture), photo and some others. At the same time it fetches flight route by sending multiple requests as well to receive information about departure, destination and for some cases midpoint airports.

5. COLLECT RESULT

This is the last step where all data are being collected and returned in declared format.

Installation

pip install plane-above

Quickstart

First, import library, create instance and pass your values of latitude & longitude as a tuple:

>>> from plane_above import PlaneAbove
>>> pa = PlaneAbove((52.457, 5.531))

Optionally, you can pass a distance attribute (in km, 15 by default):

>>> pa = PlaneAbove((52.457, 5.531), distance=20)

At this point, we can check what is happening above:

>>> pa.spotted.success
True
>>> pa.spotted.how_many
2

In cases when there are no planes detected, or retrieving information fails you will get True, 0 and False, 0 respectively. Let's go further and see what are these 2 flying objects:

>>> for above in pa.fetch():
...     print(
...         f"{above.aircraft.manufacturer} {above.aircraft.model} flying to "
...         f"{above.flight.destination.name} is {above.state.altitude} meters above you!"
...     )

Boeing 777 212ER flying to London Heathrow Airport is 11232 meters above you!
Airbus A330 342 flying to Brussels Airport (Zaventem Airport) is 1006 meters above you!

Object reference

Both fetch() and async_fetch() methods will return an iterator consisting of Above objects.

Above
class Above:
    aircraft: Aircraft
    flight: Flight
    state: State
Aircraft
class Aircraft:
    icao24: str  # Hex code of the transponder installed in the aircraft.
    country: str  # Country inferred from the aircraft's transponder address.
    age: float  # Don’t take 0.0 as a brand new plane; age likely was missing from our sources.
    photos: list[Photo]
    registration: str = ""
    manufacturer: str = ""
    model: str = ""
    type_code: str = ""  # ICAO type code (A35K, B763…).
    operator: str = ""
Photo
class Photo:
    image_url: str = ""
    origin_url: str = ""
    photographer: str = ""
Flight
class Flight:
    callsign: str  # Might be empty string if not received.
    departure: Airport
    destination: Airport
    stops: list[Airport]  # Usually empty; only a small percentage of routes include stops.
    airline: str = ""  # Airline performing flight; May differ from aircraft.operator.
Airport
class Airport:
    iata: str = "N/A"
    name: str = "Unknown airport"  # May be "Unknown departure" or "Unknown destination" when no route is found.
    country_code: str = "UN"  # ISO2 code (NL, KR, BR...).
State
class State:
    altitude: int  # Geometric altitude in meters. Can be below zero.
    velocity: int  # Ground speed in m/s. Can be zero.
    latitude: float | None = None  # WGS-84 latitude in decimal degrees.
    longitude: float | None = None  # WGS-84 longitude in decimal degrees.

Advanced usage

To adjust behavior or apply workarounds you should use a Config which can be passed as a parameter when creating PlaneAbove instance:

from plane_above import PlaneAbove, Config

my_config = Config()
PlaneAbove((52.457, 5.531), config=my_config)

Sources setup

By default, only sources without severe usage restrictions are queried, resulting in some data for Route and Photo being excluded. You can review and enable each source manually using RouteSource and PhotoSource passed to Config:

from plane_above import PlaneAbove, Config, RouteSource, PhotoSource

route_sources = (
    RouteSource.HEX_DB,  # https://hexdb.io/
    RouteSource.ADSB_DB,  # https://www.adsbdb.com/
)
photo_sources = (
    PhotoSource.HEX_DB,  # https://hexdb.io/
    PhotoSource.AIRPORT_DATA,  # https://airport-data.com/terms
    PhotoSource.PLANESPOTTERS,  # https://www.planespotters.net/photo/api#terms
)

PlaneAbove((52.457, 5.531), config=Config(route_sources=route_sources, photo_sources=photo_sources))

You can skip direct calls to photo sources entirely for performance or liability reasons and still receive photo when requesting aircraft details (if available in default provider):

PlaneAbove((52.457, 5.531), config=Config(photo_sources=()))

User-Agent setup

Some sources may deny requests sent without proper User-Agent header. To fix that pass a user_agent parameter to Config. All requests will be sharing that User-Agent:

custom_user_agent = "YourApp/1.0 (+https://example.com/contact)"
PlaneAbove((52.457, 5.531), config=Config(user_agent=custom_user_agent))

Proxy setup

In some cases requests might be rejected or timed-out without any specific reason. That's due to some sources' blocking policies and you probably would like to utilize proxy here as a workaround:

from plane_above import PlaneAbove, Config, DataSource

my_config = Config(proxy_url="http://username:password@host:port", proxy_scope=(DataSource.OPENSKY,))
PlaneAbove((52.457, 5.531), config=my_config)

Please note that only scoped sources will be called with proxy; if none is specified then no proxy will be used. Refer to DataSource enum for all available sources.

OpenSky Network Authentication

OSN allows to use its API anonymously, but with limits. If you wish to extend your usage - consider obtaining client_id and client_secret here. Then you pass extra params:

PlaneAbove((52.457, 5.531), config=Config(osn_id="your_client_id", osn_secret="your_client_secret"))

Data sources

General terms

This project aggregates data from multiple third-party services and does not claim ownership of any data returned by those services. The specific terms, restrictions, and licence conditions vary by source. Users must review and comply with the terms applicable to each source before storing, publishing, redistributing, exporting, or incorporating returned data into another database.

None of the sources we use guarantee the accuracy, timeliness, or completeness of their data, and use of each is at the user's own risk. This project is not affiliated with, endorsed by, or responsible for the content, availability, or practices of the third-party services it queries. Users must not use this project, or the sources it queries, unlawfully or in any way that could damage, disable, or impair the underlying services.

Sources

Route data notice

The flight route data is the work of David Taylor, Edinburgh and Jim Mason, Glasgow, and may not be copied, published, or incorporated into other databases without the explicit permission of David J Taylor, Edinburgh.

This notice applies specifically to flight route data obtained via adsbdb (excluded by default and requires manual enabling as RouteSource.SB), and is reproduced here for transparency and attribution purposes only. It does not constitute permission, and no such permission is granted or implied by this project.

Photo data notice

This project does not intentionally download or persist image files. It may return photo metadata and image URLs provided by third-party photo sources. Image use is subject to the terms and attribution requirements of the respective source.

Metadata

Release files for plane-above 0.6.0

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

Source distribution (sdist)

Source distribution for plane-above 0.6.0
File Size Uploaded Provenance Actions
plane_above-0.6.0.tar.gz 29.5 kB Without provenance Details for plane_above-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plane-above 0.6.0
File Interpreter ABI Platform Actions
plane_above-0.6.0-py3-none-any.whl Python 3 none any Details for plane_above-0.6.0-py3-none-any.whl

Total release size: 52.4 kB

Release files / plane_above-0.6.0.tar.gz

Download URL plane_above-0.6.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
72867b4695ebf9648475412d6ca2b2f4cded295b9d19d01f56ef00b2c9282e90
BLAKE2b-256 checksum
How to use checksums
475226c6ca8864b4ec47adcfefa8ba4e9a9d245455464ddf6ff967c1160e3199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / plane_above-0.6.0-py3-none-any.whl

Download URL plane_above-0.6.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
281895a7482cb6065d2e1c0f10eaf7ce4dbd9624c752bf2c44ffffa82bddd726
BLAKE2b-256 checksum
How to use checksums
8605a620c820737799caf6775f40b1a835846bd91a3b786b441e9741207337f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for plane-above 0.6.0

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