How to get meteo data

Hi to the community and thank you for the forum.

I try to get data from accuweather meteo API.
Up to now, no joy, I do not get any response.

const TagoUtils = require(‘tago/utils’);
const TagoAccount = require(‘tago/account’);
const Analysis = require(‘tago/analysis’);
const axios = require(‘axios’).default;

async function getMeteo() {
try {
const response = await axios.get(‘http://dataservice.accuweather.com/currentconditions/v1/349269?apikey=…’);
console.log(response);
} catch (error) {
console.error(error);
}
}

module.exports = new Analysis(getMeteo, ‘’);

I just get : [2019-11-11 12:20:32] Starting analysis 5dbd7b2efbadb70026d86fb4

Any example available ?

thank you

Max

Hi Max,
In order to print the logs to the console at TagoIO you must use context.log instead of console.log.

thank you Vitor, so I have right now :
[2019-11-11 14:05:59] {}
[2019-11-11 14:05:59] Starting analysis 5dbd7b2efbadb70026d86fb4

SO I guess there is not data received. When I use the URL directly, I got :

[{“LocalObservationDateTime”:“2019-11-11T13:55:00-03:00”,“EpochTime”:1573491300,“WeatherText”:“Mostly cloudy”,“WeatherIcon”:6,“HasPrecipitation”:false,“PrecipitationType”:null,“IsDayTime”:true,“Temperature”:{“Metric”:{“Value”:22.2,“Unit”:“C”,“UnitType”:17},“Imperial”:{“Value”:72.0,“Unit”:“F”,“UnitType”:18}},“MobileLink”:“http://m.accuweather.com/en/uy/montevideo/349269/current-weather/349269?lang=en-us",“Link”:"http://www.accuweather.com/en/uy/montevideo/349269/current-weather/349269?lang=en-us”}]

So this is not my apikey which is bad.

thank you for your help

Max

1 Like