Giter Site home page Giter Site logo

ridwaanhall / flightradarapi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jeanextreme002/flightradarapi

0.0 0.0 0.0 76 KB

:airplane: Unofficial API for FlightRadar24 written in Python 3.

Home Page: https://pypi.org/project/FlightRadarAPI/

License: MIT License

Python 100.00%

flightradarapi's Introduction

FlightRadarAPI

Unofficial API for FlightRadar24 written in Python 3.

If you want to use the data collected using this API commercially, you need to subscribe to the Business plan.
See more information at: https://www.flightradar24.com/terms-and-conditions

Python Package Pypi License Python Version Downloads

Installing FlightRadarAPI:

pip3 install FlightRadarAPI

Basic Usage:

Import the class FlightRadar24API and create an instance of it.

from FlightRadar24 import FlightRadar24API
fr_api = FlightRadar24API(...)

Getting flights list:

flights = fr_api.get_flights(...)  # Returns a list of Flight objects

Getting airports list:

airports = fr_api.get_airports(...)  # Returns a list of Airport objects

Getting airlines list:

airlines = fr_api.get_airlines()

Getting zones list:

zones = fr_api.get_zones()

You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.

flight_details = fr_api.get_flight_details(flight)
flight.set_flight_details(flight_details)

print("Flying to", flight.destination_airport_name)

Or get more information about a specific airport such as: runways, temperature, arrived flights, etc.

airport_details = fr_api.get_airport_details(airport.icao)

Filtering flights and airports:

The get_flights(...) method has some parameters to search for flights by: area line, bounds (customized coordinates or obtained by the get_zones() method), aircraft registration or aircraft type. See the example below:

airline_icao = "UAE"
aircraft_type = "B77W"

# You may also set a custom region, such as: bounds = "73,-12,-156,38"
zone = fr_api.get_zones()["northamerica"]
bounds = fr_api.get_bounds(zone)

emirates_flights = fr_api.get_flights(
    aircraft_type = aircraft_type
    airline = airline_icao,
    bounds = bounds
)

There are more configurations that you may set by using the set_flight_tracker_config(...) method. See the method documentation for more information.

Getting airport by ICAO or IATA:

lukla_airport = fr_api.get_airport(code = "VNLK")

Getting the distance between flights and airports:

The Flight and Airport classes inherit from Entity, which contains the get_distance_from(...) method. That method returns the distance between the self instance and another entity in kilometers. Example:

airport = fr_api.get_airport("KJFK")
distance = flight.get_distance_from(airport)

print(f"The flight is {distance} km away from the airport.")

Setting and getting Real-time Flight Tracker parameters:

Set it by using the set_flight_tracker_config(...) method. It receives a FlightTrackerConfig dataclass instance, but you can also use keyword arguments directly to the method.

Get the current configuration with the get_flight_tracker_config() method, that returns a FlightTrackerConfig instance. Note: creating a new FlightTrackerConfig instance means resetting all parameters to default.

flight_tracker = fr_api.get_flight_tracker_config()
flight_tracker.limit = 10

fr_api.set_flight_tracker_config(flight_tracker, ...)

flights = fr_api.get_flights(...)  # Returns only 10 flights

flightradarapi's People

Contributors

jeanextreme002 avatar dlunhappy226 avatar cdfuller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.