Skip to main content

Flightradar client library.

Project description

python-flightradar-client

Build Status Coverage Status

This library provides convenient access to a local Flightradar24 feed.

Installation

pip install flightradar-client

Usage

This library currently support two different flavour of flight data, provided by the fr24feed and dump1090-mutability services that are automatically installed when building your own Pi24 ADS-B receiver.

For each flavour the library provides two modes of access. The *Feed class fetches data once when calling update and transforms it into FeedEntry objects. The *FeedAggregator class keeps a bit of history and with each subsequent update call it tries to fill in any gaps (coordinates and callsign at the moment) missing in the latest data set fetched.

Flightradar Feed

The Flightradar Feed mode uses the JSON data made available by the fr24feed service (normally under http://localhost:8754/flights.json).

FlightradarFlightsFeed and FlightradarFlightsFeedAggregator support the same parameters:

Name Type Description
home_coordinates required, tuple of latitude and longitude Used to calculate the distance to each aircraft.
filter_radius optional, float value in kilometres, default: don't filter by distance Only aircrafts within this radius around the home coordinates are included in the result set.
url optional, full url to access the Pi24 ADS-B receiver JSON, default: construct with hostname and port Define if you have customised access to Pi24 ADS-B receiver or use HTTPS for example.
hostname optional, hostname of the Pi24 ADS-B receiver, default: localhost Define if you are not running this library on your Pi24 ADS-B receiver.
port optional, port of the Pi24 ADS-B receiver's flights service, default: 8754 Define if you have configured a different port on your Pi24 ADS-B receiver.

Feed

import asyncio
import aiohttp
from flightradar_client.fr24feed_flights import FlightradarFlightsFeed
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed = FlightradarFlightsFeed((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed.update())

Feed Aggregator

import asyncio
import aiohttp
from flightradar_client.fr24feed_flights import FlightradarFlightsFeedAggregator
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed_aggregator = FlightradarFlightsFeedAggregator((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed_aggregator.update())

Dump1090 Feed

The Dump1090 Feed mode uses the JSON data made available by the dump1090-mutability service (normally under http://localhost:8888/data/aircraft.json).

Dump1090AircraftsFeed and Dump1090AircraftsFeedAggregator support the same parameters:

Name Type Description
home_coordinates required, tuple of latitude and longitude Used to calculate the distance to each aircraft.
filter_radius optional, float value in kilometres, default: don't filter by distance Only aircrafts within this radius around the home coordinates are included in the result set.
url optional, full url to access the Pi24 ADS-B receiver JSON, default: construct with hostname and port Define if you have customised access to Pi24 ADS-B receiver or use HTTPS for example.
hostname optional, hostname of the Pi24 ADS-B receiver, default: localhost Define if you are not running this library on your Pi24 ADS-B receiver.
port optional, port of the Pi24 ADS-B receiver's dump1090 service, default: 8888 Define if you have configured a different port on your Pi24 ADS-B receiver.

Feed

import asyncio
import aiohttp
from flightradar_client.dump1090_aircrafts import Dump1090AircraftsFeed
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed = Dump1090AircraftsFeed((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed.update())

Feed Aggregator

import asyncio
import aiohttp
from flightradar_client.dump1090_aircrafts import Dump1090AircraftsFeedAggregator
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed_aggregator = Dump1090AircraftsFeedAggregator((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed_aggregator.update())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flightradar_client-0.5.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flightradar_client-0.5-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file flightradar_client-0.5.tar.gz.

File metadata

  • Download URL: flightradar_client-0.5.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for flightradar_client-0.5.tar.gz
Algorithm Hash digest
SHA256 1092ff3741db419911fe03c6d3c706df939b044d5a98832712e630822e5a7b5a
MD5 80f2a93fd2cf1ea862bedb88107ded09
BLAKE2b-256 13455341d37aa5b52d0b7a20fcd6978898508a9648cdf04e71dc33d55d351ecb

See more details on using hashes here.

File details

Details for the file flightradar_client-0.5-py3-none-any.whl.

File metadata

  • Download URL: flightradar_client-0.5-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for flightradar_client-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5cfc8e22477d6810e7d90a7983fcfc14b848057fce356db5a299cae2b7206cd8
MD5 820ae4068be9544b7e57ad14bff4e8a8
BLAKE2b-256 e8f74aac95c2c92eaa4fc99f3cc9ce7ae2cd1b6bd004c9ae2e74ba421628c383

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page