From 70e5d26703d59c6ba6db90cd2f13f99eb2c7afce Mon Sep 17 00:00:00 2001 From: JeanExtreme002 Date: Sun, 24 Dec 2023 21:11:51 -0300 Subject: [PATCH] added getVolcanicEruptions() method --- nodejs/FlightRadar24/api.js | 12 ++++++++++++ nodejs/FlightRadar24/core.js | 3 +++ nodejs/FlightRadar24/index.js | 2 +- nodejs/package-lock.json | 4 ++-- nodejs/package.json | 2 +- python/FlightRadar24/__init__.py | 2 +- python/FlightRadar24/api.py | 7 +++++++ python/FlightRadar24/core.py | 3 +++ 8 files changed, 30 insertions(+), 5 deletions(-) diff --git a/nodejs/FlightRadar24/api.js b/nodejs/FlightRadar24/api.js index ac6309e..87792cb 100644 --- a/nodejs/FlightRadar24/api.js +++ b/nodejs/FlightRadar24/api.js @@ -379,6 +379,18 @@ class FlightRadar24API { return await response.getContent(); } + /** + * Return boundaries of volcanic eruptions and ash clouds impacting aviation. + * + * @return {object} + */ + async getVolcanicEruptions() { + const response = new APIRequest(Core.volcanicEruptionDataUrl, null, Core.json_headers); + await response.receive(); + + return await response.getContent(); + } + /** * Return all major zones on the globe. * diff --git a/nodejs/FlightRadar24/core.js b/nodejs/FlightRadar24/core.js index b06afc3..8246ce9 100644 --- a/nodejs/FlightRadar24/core.js +++ b/nodejs/FlightRadar24/core.js @@ -37,6 +37,9 @@ class Core { // Zones data URL. this.zonesDataUrl = this.flightRadarBaseUrl + "/js/zones.js.php"; + // Weather data URL. + this.volcanicEruptionDataUrl = this.flightRadarBaseUrl + "/weather/volcanic"; + // Country flag image URL. this.countryFlagUrl = this.flightRadarBaseUrl + "/static/images/data/flags-small/{}.svg"; diff --git a/nodejs/FlightRadar24/index.js b/nodejs/FlightRadar24/index.js index 000fb3c..6e2d954 100644 --- a/nodejs/FlightRadar24/index.js +++ b/nodejs/FlightRadar24/index.js @@ -18,7 +18,7 @@ const Entity = require("./entities/entity"); const Flight = require("./entities/flight"); const author = "Jean Loui Bernard Silva de Jesus"; -const version = "1.3.21"; +const version = "1.3.22"; module.exports = { FlightRadar24API, diff --git a/nodejs/package-lock.json b/nodejs/package-lock.json index 685cc17..7cf008f 100644 --- a/nodejs/package-lock.json +++ b/nodejs/package-lock.json @@ -1,12 +1,12 @@ { "name": "flightradarapi", - "version": "1.3.21", + "version": "1.3.22", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "flightradarapi", - "version": "1.3.21", + "version": "1.3.22", "license": "MIT", "dependencies": { "form-data": "^4.0.0", diff --git a/nodejs/package.json b/nodejs/package.json index 3923564..6d0222e 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "flightradarapi", - "version": "1.3.21", + "version": "1.3.22", "description": "SDK for FlightRadar24", "main": "./FlightRadar24/index.js", "scripts": { diff --git a/python/FlightRadar24/__init__.py b/python/FlightRadar24/__init__.py index 2e996d2..3c8c0be 100644 --- a/python/FlightRadar24/__init__.py +++ b/python/FlightRadar24/__init__.py @@ -13,7 +13,7 @@ """ __author__ = "Jean Loui Bernard Silva de Jesus" -__version__ = "1.3.19" +__version__ = "1.3.20" from .api import FlightRadar24API, FlightTrackerConfig from .entities import Airport, Entity, Flight diff --git a/python/FlightRadar24/api.py b/python/FlightRadar24/api.py index 2ed4a63..a45daa7 100644 --- a/python/FlightRadar24/api.py +++ b/python/FlightRadar24/api.py @@ -327,6 +327,13 @@ def get_most_tracked(self) -> Dict: response = APIRequest(Core.most_tracked_url, headers = Core.json_headers) return response.get_content() + def get_volcanic_eruptions(self) -> Dict: + """ + Return boundaries of volcanic eruptions and ash clouds impacting aviation. + """ + response = APIRequest(Core.volcanic_eruption_data_url, headers = Core.json_headers) + return response.get_content() + def get_zones(self) -> Dict[str, Dict]: """ Return all major zones on the globe. diff --git a/python/FlightRadar24/core.py b/python/FlightRadar24/core.py index 06247e7..f6c4511 100644 --- a/python/FlightRadar24/core.py +++ b/python/FlightRadar24/core.py @@ -37,6 +37,9 @@ class Core(ABC): # Zones data URL. zones_data_url = flightradar_base_url + "/js/zones.js.php" + # Weather data URL. + volcanic_eruption_data_url = flightradar_base_url + "/weather/volcanic" + # Country flag image URL. country_flag_url = flightradar_base_url + "/static/images/data/flags-small/{}.svg"