MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / getCurrentAirportWeather

Function getCurrentAirportWeather

services/cptec/weather.js:86–100  ·  view source on GitHub ↗
(icaoCode)

Source from the content-addressed store, hash-verified

84 * @returns {object}
85 */
86export const getCurrentAirportWeather = async (icaoCode) => {
87 const airportWeather = await axios.get(
88 `${CPTEC_URL}/estacao/${icaoCode}/condicoesAtuais.xml`,
89 {
90 responseType: 'application/xml',
91 responseEncoding: 'utf-8',
92 }
93 );
94 const parsed = parser.parse(airportWeather.data);
95
96 if (parsed.metar) {
97 return formatMetar(parsed.metar);
98 }
99 return [];
100};
101
102/**
103 * Get weather predicion for the next 7 days with location based

Callers 1

actionFunction · 0.90

Calls 1

formatMetarFunction · 0.85

Tested by

no test coverage detected