FlightRadarAPI


NameFlightRadarAPI JSON
Version 1.3.26 PyPI version JSON
download
home_pageNone
SummarySDK for FlightRadar24
upload_time2024-03-23 04:56:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords aircraft airlines airports api aviation flightradar24 flights radar
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # FlightRadarAPI
Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) written in Python 3.

If you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>
See more information at: https://www.flightradar24.com/terms-and-conditions

[![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)
[![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)
[![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)
[![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)
[![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)
[![downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pypi.org/project/FlightRadarAPI/)
[![Frequency](https://img.shields.io/pypi/dm/flightradarapi?style=flat&label=frequency)](https://pypi.org/project/FlightRadarAPI/)

## Installing FlightRadarAPI:
```
pip install FlightRadarAPI
```

## Basic Usage:
Import the class `FlightRadar24API` and create an instance of it.
```py
from FlightRadar24 import FlightRadar24API
fr_api = FlightRadar24API()
```

**Getting flights list:**
```py
flights = fr_api.get_flights(...)  # Returns a list of Flight objects
```

**Getting airports list:**
```py
airports = fr_api.get_airports(...)  # Returns a list of Airport objects
```

**Getting airlines list:**
```py
airlines = fr_api.get_airlines()
```

**Getting zones list:**
```py
zones = fr_api.get_zones()
```

### Getting flight and airport details
You can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.
```py
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, weather, arrived flights, etc.
```py
airport_details = fr_api.get_airport_details(icao)
```
Arrivals and departures can have a limit `flight_limit` (max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter `page` to view other pages.


## Get flights above your position:
The `get_bounds_by_point(...)` method has parameters `latitude` and `longitude` for your position and `radius` for the distance in meters from your position to designate a tracking area.
```py
# Your point is 52°34'04.7"N 13°16'57.5"E from Google Maps and radius 2km
bounds = fr_api.get_bounds_by_point(52.567967, 13.282644, 2000)

flights = fr_api.get_flights(bounds = bounds)
```

## 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:
```py
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:**
```py
lukla_airport = fr_api.get_airport(code = "VNLK", details = True)
```

## 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:
```py
airport = fr_api.get_airport("KJFK")
distance = flight.get_distance_from(airport)

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

## Downloading Flight Data
*Note*: This requires a premium subscription and for you to be logged in.

```py
history_data = fr_api.get_history_data(flight, file_type="csv", time=1706529600)

 with open("history_data.csv", "w") as file:
    file.write(history_data)
```

`flight_id` - The ID of the flight. Can be gotten from any other function that returns flight details.
`file_type` - Either CSV or KML.
`time` - The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.

## 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.
```py
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
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "FlightRadarAPI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "aircraft, airlines, airports, api, aviation, flightradar24, flights, radar",
    "author": null,
    "author_email": "Jean Loui Bernard Silva de Jesus <jeanextreme002@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7a/aa/a9a69177b8f0ab3f30a3dc7c5301cf68fb44d5fc8632dd9667fce978c352/flightradarapi-1.3.26.tar.gz",
    "platform": null,
    "description": "# FlightRadarAPI\nUnofficial SDK for [FlightRadar24](https://www.flightradar24.com/) written in Python 3.\n\nIf you want to use the data collected using this SDK commercially, you need to subscribe to the [Business plan](https://www.flightradar24.com/premium/).</br>\nSee more information at: https://www.flightradar24.com/terms-and-conditions\n\n[![Python Package](https://github.com/JeanExtreme002/FlightRadarAPI/workflows/Python%20Package/badge.svg)](https://github.com/JeanExtreme002/FlightRadarAPI/actions)\n[![Pypi](https://img.shields.io/pypi/v/FlightRadarAPI?logo=pypi)](https://pypi.org/project/FlightRadarAPI/)\n[![License](https://img.shields.io/pypi/l/FlightRadarAPI)](https://github.com/JeanExtreme002/FlightRadarAPI)\n[![Python Version](https://img.shields.io/badge/python-3.7+-8A2BE2)](https://pypi.org/project/FlightRadarAPI/)\n[![Npm](https://img.shields.io/npm/v/flightradarapi?logo=npm&color=red)](https://www.npmjs.com/package/flightradarapi)\n[![downloads](https://static.pepy.tech/personalized-badge/flightradarapi?period=total&units=international_system&left_color=grey&right_color=orange&left_text=Downloads)](https://pypi.org/project/FlightRadarAPI/)\n[![Frequency](https://img.shields.io/pypi/dm/flightradarapi?style=flat&label=frequency)](https://pypi.org/project/FlightRadarAPI/)\n\n## Installing FlightRadarAPI:\n```\npip install FlightRadarAPI\n```\n\n## Basic Usage:\nImport the class `FlightRadar24API` and create an instance of it.\n```py\nfrom FlightRadar24 import FlightRadar24API\nfr_api = FlightRadar24API()\n```\n\n**Getting flights list:**\n```py\nflights = fr_api.get_flights(...)  # Returns a list of Flight objects\n```\n\n**Getting airports list:**\n```py\nairports = fr_api.get_airports(...)  # Returns a list of Airport objects\n```\n\n**Getting airlines list:**\n```py\nairlines = fr_api.get_airlines()\n```\n\n**Getting zones list:**\n```py\nzones = fr_api.get_zones()\n```\n\n### Getting flight and airport details\nYou can also get more information about a specific flight such as: estimated time, trail, aircraft details, etc.\n```py\nflight_details = fr_api.get_flight_details(flight)\nflight.set_flight_details(flight_details)\n\nprint(\"Flying to\", flight.destination_airport_name)\n```\n\nOr get more information about a specific airport such as: runways, weather, arrived flights, etc.\n```py\nairport_details = fr_api.get_airport_details(icao)\n```\nArrivals and departures can have a limit `flight_limit` (max value is 100) to display. When you need to reach more than 100 flights you can use additional parameter `page` to view other pages.\n\n\n## Get flights above your position:\nThe `get_bounds_by_point(...)` method has parameters `latitude` and `longitude` for your position and `radius` for the distance in meters from your position to designate a tracking area.\n```py\n# Your point is 52\u00b034'04.7\"N 13\u00b016'57.5\"E from Google Maps and radius 2km\nbounds = fr_api.get_bounds_by_point(52.567967, 13.282644, 2000)\n\nflights = fr_api.get_flights(bounds = bounds)\n```\n\n## Filtering flights and airports:\nThe `get_flights(...)` method has some parameters to search for flights by: area line, bounds (customized coordinates \nor obtained by the `get_zones()` method), aircraft registration or aircraft type. See the example below:\n```py\nairline_icao = \"UAE\"\naircraft_type = \"B77W\"\n\n# You may also set a custom region, such as: bounds = \"73,-12,-156,38\"\nzone = fr_api.get_zones()[\"northamerica\"]\nbounds = fr_api.get_bounds(zone)\n\nemirates_flights = fr_api.get_flights(\n    aircraft_type = aircraft_type\n    airline = airline_icao,\n    bounds = bounds\n)\n```\nThere are more configurations that you may set by using the `set_flight_tracker_config(...)` method. See the method documentation\nfor more information.\n\n**Getting airport by ICAO or IATA:**\n```py\nlukla_airport = fr_api.get_airport(code = \"VNLK\", details = True)\n```\n\n## Getting the distance between flights and airports:\nThe `Flight` and `Airport` classes inherit from `Entity`, which contains the `get_distance_from(...)` method. That method\nreturns the distance between the self instance and another entity in kilometers. Example:\n```py\nairport = fr_api.get_airport(\"KJFK\")\ndistance = flight.get_distance_from(airport)\n\nprint(f\"The flight is {distance} km away from the airport.\")\n```\n\n## Downloading Flight Data\n*Note*: This requires a premium subscription and for you to be logged in.\n\n```py\nhistory_data = fr_api.get_history_data(flight, file_type=\"csv\", time=1706529600)\n\n with open(\"history_data.csv\", \"w\") as file:\n    file.write(history_data)\n```\n\n`flight_id` - The ID of the flight. Can be gotten from any other function that returns flight details.\n`file_type` - Either CSV or KML.\n`time` - The STD/scheduled time of deperature in UTC of the flight as a Unix timestamp. Putting an invalid time will return a blank document.\n\n## Setting and getting Real-time Flight Tracker parameters:\nSet it by using the `set_flight_tracker_config(...)` method. It receives a `FlightTrackerConfig` dataclass instance, but\nyou can also use keyword arguments directly to the method.\n\nGet the current configuration with the `get_flight_tracker_config()` method, that returns a `FlightTrackerConfig` \ninstance. Note: creating a new `FlightTrackerConfig` instance means resetting all parameters to default.\n```py\nflight_tracker = fr_api.get_flight_tracker_config()\nflight_tracker.limit = 10\n\nfr_api.set_flight_tracker_config(flight_tracker, ...)\n\nflights = fr_api.get_flights(...)  # Returns only 10 flights\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "SDK for FlightRadar24",
    "version": "1.3.26",
    "project_urls": {
        "Homepage": "https://github.com/JeanExtreme002/FlightRadarAPI"
    },
    "split_keywords": [
        "aircraft",
        " airlines",
        " airports",
        " api",
        " aviation",
        " flightradar24",
        " flights",
        " radar"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b839c243d9e9c81b78a8be3083a502ce25a5fc6b56d11b76d1124f4982cb694",
                "md5": "33faba3cab7d8d80d29928775c0475d1",
                "sha256": "8b9f4cb7fa347960506ca13e765412009bca2655acf76f12810a62d0d50a3d7b"
            },
            "downloads": -1,
            "filename": "flightradarapi-1.3.26-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "33faba3cab7d8d80d29928775c0475d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 16478,
            "upload_time": "2024-03-23T04:56:39",
            "upload_time_iso_8601": "2024-03-23T04:56:39.316309Z",
            "url": "https://files.pythonhosted.org/packages/5b/83/9c243d9e9c81b78a8be3083a502ce25a5fc6b56d11b76d1124f4982cb694/flightradarapi-1.3.26-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7aaaa9a69177b8f0ab3f30a3dc7c5301cf68fb44d5fc8632dd9667fce978c352",
                "md5": "75a63c31e0a37c5487b887b480f2a9ff",
                "sha256": "6537b81097e5687c4571c10ff628cb036fea0725e3a9b3f4b2da3c8c0585bc32"
            },
            "downloads": -1,
            "filename": "flightradarapi-1.3.26.tar.gz",
            "has_sig": false,
            "md5_digest": "75a63c31e0a37c5487b887b480f2a9ff",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 15100,
            "upload_time": "2024-03-23T04:56:41",
            "upload_time_iso_8601": "2024-03-23T04:56:41.574988Z",
            "url": "https://files.pythonhosted.org/packages/7a/aa/a9a69177b8f0ab3f30a3dc7c5301cf68fb44d5fc8632dd9667fce978c352/flightradarapi-1.3.26.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-23 04:56:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JeanExtreme002",
    "github_project": "FlightRadarAPI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "flightradarapi"
}
        
Elapsed time: 0.20924s