Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Documentation Using MkDocs #65

Merged
merged 17 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy MkDocs
on:
push:
branches:
- main
paths:
- 'mkdocs.yml'
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install \
mkdocs-material \
mkdocs-git-committers-plugin-2
- run: mkdocs gh-deploy --force
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ dist
.idea/
venv/
node_modules/
.env
.env
.cache
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,4 @@ npm install flightradarapi
```

## Documentation
Explore the documentation of FlightRadarAPI package, for Python or NodeJS, through the links below.
- [Documentation of FlightRadarAPI for Python 3](./python/README.md)
- [Documentation of FlightRadarAPI for NodeJS](./nodejs/README.md)
Explore the documentation of FlightRadarAPI package, for Python or NodeJS, through [this site](https://JeanExtreme002.github.io/FlightRadarAPI/)
Binary file added docs/assets/favicon.ico
Binary file not shown.
Binary file added docs/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# FlightRadarAPI Documentation

Unofficial SDK for [FlightRadar24](https://www.flightradar24.com/) for Python 3 and NodeJS.

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](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/)

!!! info
This is NOT an official FlightRadar24 API. You can access their official API [here](https://fr24api.flightradar24.com/).

<div class="grid cards" markdown>

- :octicons-file-code-16:{ .lg .middle } __100% Free and Open Source!__

---

The code is open source and available for inspection on GitHub.


- :material-sticker-check-outline:{ .lg .middle } __Trustworthy Service__

---

All data is parsed from the FlightRadar24, which is a reliable source for real-time flight data.

</div>

<div class="grid cards" align="center" markdown>



</div>

## Installation

### Python
To install FlightRadarAPI for Python using pip, run the following command in your terminal:

```bash
pip install FlightRadarAPI
```

### NodeJS
To install FlightRadarAPI for NodeJS using npm, run the following command in your terminal:

```bash
npm install flightradarapi
```
158 changes: 158 additions & 0 deletions docs/nodejs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
---
title: Node.js
description: API Documentation for Node.js
---

## Installation

To install the FlightRadarAPI for Node.js, use the following npm command:

```bash
npm install flightradarapi
```

## Basic Usage

Start by importing the `FlightRadar24API` class and creating an instance of it:

```javascript
const { FlightRadar24API } = require("flightradarapi");
const frApi = new FlightRadar24API();
```

### Fetching Data

You can fetch various types of data using the following methods:

- **Flights list:**

```javascript
let flights = await frApi.getFlights(...); // Returns a list of Flight objects
```

- **Airports list:**

```javascript
let airports = await frApi.getAirports(...); // Returns a list of Airport objects
```

- **Airlines list:**

```javascript
let airlines = await frApi.getAirlines();
```

- **Zones list:**

```javascript
let zones = await frApi.getZones();
```

### Fetching Detailed Information

Fetch more information about a specific flight or airport using the following methods:

- **Flight details:**

```javascript
let flightDetails = await frApi.getFlightDetails(flight);
flight.setFlightDetails(flightDetails);

console.log("Flying to", flight.destinationAirportName);
```

- **Airport details:**

```javascript
let airportDetails = await frApi.getAirportDetails(icao);
```

!!! note
Arrivals and departures can have a limit `flightLimit` (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.

## Advanced Usage

### Fetching Flights Above a Specific Position

Use the `getBoundsByPoint(...)` method to fetch flights above a specific position. This method takes `latitude` and `longitude` for your position and `radius` for the distance in meters from your position to designate a tracking area.

```javascript
// Your point is 52°34'04.7"N 13°16'57.5"E from Google Maps and radius 2km
let bounds = frApi.getBoundsByPoint(52.567967, 13.282644, 2000);

let flights = await frApi.getFlights(null, bounds);
```

### Filtering Flights and Airports

Use the `getFlights(...)` method to search for flights by area line, bounds (customized coordinates or obtained by the `getZones()` method), aircraft registration or aircraft type.

```javascript
let airlineIcao = "UAE";
let aircraftType = "B77W";

// You may also set a custom region, such as: bounds = "73,-12,-156,38"
let zone = (await frApi.getZones())["northamerica"];
let bounds = frApi.getBounds(zone);

let emiratesFlights = await frApi.getFlights(
airlineIcao,
bounds,
null,
aircraftType,
);
```

### Fetching Airport by ICAO or IATA

```javascript
let luklaAirport = await frApi.getAirport("VNLK", true);
```

### Calculating Distance Between Flights and Airports

The `Flight` and `Airport` classes inherit from `Entity`, which contains the `getDistanceFrom(...)` method. This method returns the distance between the self instance and another entity in kilometers.

```javascript
let airport = await frApi.getAirport("KJFK");
let distance = flight.getDistanceFrom(airport);

console.log("The flight is", distance, "km away from the airport.");
```

## Downloading Flight Data :material-information-outline:{ title="This requires a premium subscription" }

You can download flight data in either CSV or KML format. The method `getHistoryData(...)` is used for this purpose. It takes three parameters:

!!! warning inline end
If an invalid time is provided, a blank document will be returned.

| Parameter | Description |
| ------------- | ------------- |
| `flight_id` | The ID of the flight. This can be obtained from any other function that returns flight details. |
| `file_type` | The format of the file to download. This can be either "CSV" or "KML". |
| `time` | The scheduled time of departure (STD) of the flight in UTC, as a Unix timestamp. |

Here is an example of how to use this method:

```javascript
let historyData = await frApi.getHistoryData(flight, "csv", 1706529600);

const buffer = Buffer.from(historyData);
fs.writeFile("history_data.csv", buffer);
```

### Setting and Getting Real-time Flight Tracker Parameters

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

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

```javascript
let flightTracker = frApi.getFlightTrackerConfig();
flightTracker.limit = 10

frApi.setFlightTrackerConfig(flightTracker, ...);

let flights = await frApi.getFlights(...); // Returns only 10 flights
```
42 changes: 42 additions & 0 deletions docs/projects.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Projects using FlightRadarAPI
description: Nice projects that use FlightRadarAPI
---

<div class="grid cards" align="center" markdown>

- [__Automatic Calibration in Crowd-sourced Network of Spectrum Sensors__](https://dl.acm.org/doi/10.1145/3626111.3628187)

---

By Ali Abedi, Joshua Sanz, Anant Sahai, from University of California (UC), Berkeley


- [__Airline Status Tracker for top 10 Airport Departures in North America__](https://people.ischool.berkeley.edu/~frank.song/flight.html)

---

By Adeleke Coker, Frank Song, Greg Chi, from University of California (UC), Berkeley, School of Information

- [__Flight Tracker with Weather__](https://magpi.raspberrypi.com/articles/flight-tracker-with-weather)

---

By Adam Paulson, a Reddit user going by the name C0wsaysmoo

- [__Design and implementation project of an aircraft mobile node module for the SeamSAT-LEO constellation simulator__](https://upcommons.upc.edu/bitstream/handle/2117/394691/TFG.pdf?sequence=2&isAllowed=y)

---

By David Anton Dobarro, graduate in Aerospace Technologies Engineering from Universitat Politècnica de Catalunya

- [__Fridge Flight Tracker__](https://blog.colinwaddell.com/flight-tracker/)

---

By Colin Waddell, a Glasgow based programmer, website designer and electronics specialist


</div>

[Contribute Your Own](https://github.com/JeanExtreme002/FlightRadarAPI/edit/master/docs/projects.md){ .md-button .md-button--primary }
Loading
Loading