Skip to main content
plane-above

Plane Above

PyPI version License Python versions Ruff mypy

Plane Above is a python package featuring a convinient way to retrieve planes above certain point.

One notable usage example...

Try Plane Above telegram bot. tg-bot

Before we start...

To collect data, this library utilizes various sources. They are open and maintained by enthusiasts mostly. So, use responsively! Don't push the limits and take actions with care. Please mind that data might be missing, incorrect or outdated.

How it works

Note: here and after I would refer to any flying object as an «aircraft» or «plane», but keep in mind that it also includes helicopters, gliders, rotorcraft and even balloons.

1. BUILD SEARCHING AREA

With given latitude and longitude of point it builds area of search by calculating bounding box coordinates based on required distance from point.

2. RETRIEVE STATES

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

3. PICK DATA

After receiving states (if request was successful, we did not exceed limits and received at least one state) it picks crucial data and filters out excessive 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 registered altitude and velocity.

4. FETCH DETAILS

Based on previous step we enrich the data by making requests to multiple sources to retrieve information about aircraft such as: registration code, manufacturer and model, age (based on built date) and operating airline/registered owner. It continues with the route and send multiple requests as well to receive information about departure, destination and for some cases midpoint airports. Finally, it searches for the aircraft photo.

5. BUILD RESULT

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

Installation

pip install plane-above

Usage

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

>>> from plane_above import PlaneAbove
>>> pa = PlaneAbove((52.4573212, 5.5301535))

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

>>> pa = PlaneAbove((52.4573212, 5.5301535), distance=20)

Great, by this time we already know what is happening above that point, so let's check it:

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

In cases when there are no plane detected, or we failed to retrieve information you will get True, 0 and False, 0 respectively. Let's go further and see what are that 2 flying objects:

>>> for plane in pa.fetch():
...     print(
...         f"{plane.aircraft.manufacturer} {plane.aircraft.model} flying to "
...         f"{plane.route.destination.name} is {plane.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!

If you live in acynchronious environment, call async.fetch() instead:

>>> async for plane in pa.async_fetch():
    ...

Object Reference

Aircraft
class Aircraft:
  registration: str
  manufacturer: str
  model: str
  operator: str
  age: float

Note: don’t take age 0.0 as a really new plane, as age is might be missing from our sources; all strings might be empty strings.

Photo
class Photo:
  image_url: str
  origin_url: str
  photographer: str

Note: all strings might be empty strings.

Airport
class Airport:
  iata: str = "N/A"
  name: str = "Unknown airport"
  country_code: str = ""
Route
class Route:
  departure: Airport
  destination: Airport
  stops: list[Airport]
  airline: str | None = None
State
class State:
  altitude: int
  velocity: int

Note: velocity and/or altitude can be 0 if no data from transponder received.

Plane
class Plane:
  icao24: str
  callsign: str
  country_code: str
  aircraft: Aircraft
  route: Route
  state: State
  photo: Photo

Limitations

OpenSky Network allows to use it's api anonymously, but with limits. If you wish to extend your usage - consider obtaining client_id and client_secret here. Then you pass it like this:

PlaneAbove((52.4573212, 5.5301535), osn_id="your_client_id", osn_secret="your_client_secret")

In some cases your calls to OpenSky Network might be timed-out without any specific reason, that's due to OSN blocking policies and you probably would like to utilize proxy here as a workaround:

PlaneAbove((52.4573212, 5.5301535), osn_proxy="http://username:password@host:port")

Please note that this will be used for making an OSN request only; other sources won't be called with that proxy.

One of our photo sources has a strict policy about making requests with unique and descriptive user-agents. That's doable with an extra param:

PlaneAbove((52.4573212, 5.5301535), ps_user_agent="YourApp/1.0 (+https://example.com/contact)")

However, you are free to skip it as it won't affect other photo sources.

Credits

Metadata

Release files for plane-above 0.1.1

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.1.1
File Size Uploaded Provenance Actions
plane_above-0.1.1.tar.gz 20.5 kB Without provenance Details for plane_above-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 35.6 kB

Release files / plane_above-0.1.1.tar.gz

Download URL plane_above-0.1.1.tar.gz
Size 20.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e2fb6d1178df7e6e51393254d055bece065e58ac5d3d6de3406fe6fcb9fac434
BLAKE2b-256 checksum
How to use checksums
7f80267991e3da07d2d405060c6b241c2dcd020bf71a32f5142ed9a9266fa6e4
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.1.1-py3-none-any.whl

Download URL plane_above-0.1.1-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8750a69caec8d230d68d387ec8634406f1a12715546a43c6c67511a3b42bfc83
BLAKE2b-256 checksum
How to use checksums
3bb91bf4a3233bccde0ce15e4057542e21a5a412e9793a7acc083e03934d6d02
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.1.1

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