야후 날씨 API 사용시 "OST_OAUTH_PARAMETER_ABSENT_ERROR" 오류 발생

2016. 3. 26. 19:28서버 프로그래밍

기존에 열심히 사용하고 있던 야후 날씨 API가 갑자기 에러를 리턴한다.

http://weather.yahooapis.com/forecastrss?w=2345975&u=c

<yahoo:error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xml:lang="en-US" yahoo:uri="http://yahoo.com">
<yahoo:description>
Please provide valid credentials. OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com"
</yahoo:description>
<yahoo:detail>
Please provide valid credentials. OAuth oauth_problem="OST_OAUTH_PARAMETER_ABSENT_ERROR", realm="yahooapis.com"
</yahoo:detail>
</yahoo:error>


OAuth 2.0 방식으로 인증을 받아야하는 것 같아서 찾아보다가, YQL을 이용하면 정상 이용이 가능해서 YQL을 이용하는 방식으로 변경했다.

https://developer.yahoo.com/weather/


var YQL = require('yql');

var query = new YQL('select * from weather.forecast where woeid=1132599');

query.exec(function(err, data) {

  var location = data.query.results.channel.location;

  var condition = data.query.results.channel.item.condition;  

  console.log('The current weather in ' + location.city + ', ' + location.region + ' is ' + condition.temp + ' degrees.');

});