[SANITY CHECK]: Can anyone else access the Yahoo! Weather API?

[SANITY CHECK]: Can anyone else access the Yahoo! Weather API?
0

#1

Hi, I’ve been using the weather-api module for my weather API, and I noticed that it returned None, every time. Hmm… I thought. I went to the Yahoo! developer page to see if it was wrong on their end. Scroll down to the examples section, and:

{
 "query": {
  "count": 0,
  "created": "2018-08-30T20:25:43Z",
  "lang": "en-US",
  "results": null
 }
}

It appears that even Yahoo! is having a tough time dealing with their API.

So, my real question is if anyone else gets the same result. Like I said before, this is a sanity check.

Thanks!


#2

I went to the developer page, copied out the JavaScript example, and created a jsfiddle for it based on the endpoint for the "Wind for Chicago, IL. I get as a result:

/**/callbackFunction({
	"query": {
		"count": 1,
		"created": "2018-08-31T13:45:36Z",
		"lang": "en-US",
		"results": {
			"channel": {
				"wind": {
					"chill": "64",
					"direction": "170",
					"speed": "14"
				}
			}
		}
	}
});

I created a Python fiddle from the Python example, which gives the result

{
	u'channel': {
		u'wind': {
			u'direction': u'170',
			u'speed': u'14',
			u'chill': u'64'
		}
	}
}

so it looks as though it’s working as intended.

The issue might be with the weather-api itself, so I created another fiddle using it and wrote out the location object as JSON data to get

pip install weather-api
pip install json
from weather import Weather, Unit
import json
weather = Weather(unit=Unit.CELSIUS)
location = weather.lookup_by_location('chicago')
condition = location.condition
print(json.dumps(vars(location)))

and got

{
	"_weather_data": {
		"lastBuildDate": "Fri, 31 Aug 2018 08:57 AM CDT",
		"atmosphere": {
			"pressure": "33796.17",
			"rising": "0",
			"visibility": "25.91",
			"humidity": "71"
		},
		"description": "Yahoo! Weather for Chicago, IL, US",
		"language": "en-us",
		"title": "Yahoo! Weather - Chicago, IL, US",
		"image": {
			"url": "http://l.yimg.com/a/i/brand/purplelogo//uh/us/news-wea.gif",
			"width": "142",
			"height": "18",
			"link": "http://weather.yahoo.com",
			"title": "Yahoo! Weather"
		},
		"item": {
			"description": "<![CDATA[<img src=\"http://l.yimg.com/a/i/us/we/52/32.gif\"/>\n<BR />\n<b>Current Conditions:</b>\n<BR />Sunny\n<BR />\n<BR />\n<b>Forecast:</b>\n<BR /> Fri - Partly Cloudy. High: 26Low: 12\n<BR /> Sat - Thunderstorms. High: 28Low: 23\n<BR /> Sun - Thunderstorms. High: 28Low: 22\n<BR /> Mon - Thunderstorms. High: 30Low: 23\n<BR /> Tue - Thunderstorms. High: 29Low: 24\n<BR />\n<BR />\n<a href=\"http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2379574/\">Full Forecast at Yahoo! Weather</a>\n<BR />\n<BR />\n<BR />\n]]>",
			"pubDate": "Fri, 31 Aug 2018 08:00 AM CDT",
			"title": "Conditions for Chicago, IL, US at 08:00 AM CDT",
			"long": "-87.632408",
			"forecast": [{
				"code": "30",
				"text": "Partly Cloudy",
				"high": "26",
				"low": "12",
				"date": "31 Aug 2018",
				"day": "Fri"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "28",
				"low": "23",
				"date": "01 Sep 2018",
				"day": "Sat"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "28",
				"low": "22",
				"date": "02 Sep 2018",
				"day": "Sun"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "30",
				"low": "23",
				"date": "03 Sep 2018",
				"day": "Mon"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "29",
				"low": "24",
				"date": "04 Sep 2018",
				"day": "Tue"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "28",
				"low": "23",
				"date": "05 Sep 2018",
				"day": "Wed"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "27",
				"low": "22",
				"date": "06 Sep 2018",
				"day": "Thu"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "25",
				"low": "21",
				"date": "07 Sep 2018",
				"day": "Fri"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "23",
				"low": "20",
				"date": "08 Sep 2018",
				"day": "Sat"
			},
			{
				"code": "4",
				"text": "Thunderstorms",
				"high": "23",
				"low": "20",
				"date": "09 Sep 2018",
				"day": "Sun"
			}],
			"link": "http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2379574/",
			"lat": "41.884151",
			"guid": {
				"isPermaLink": "false"
			},
			"condition": {
				"date": "Fri, 31 Aug 2018 08:00 AM CDT",
				"text": "Sunny",
				"code": "32",
				"temp": "18"
			}
		},
		"link": "http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2379574/",
		"location": {
			"city": "Chicago",
			"region": " IL",
			"country": "United States"
		},
		"ttl": "60",
		"units": {
			"distance": "km",
			"speed": "km/h",
			"temperature": "C",
			"pressure": "mb"
		},
		"astronomy": {
			"sunset": "7:26 pm",
			"sunrise": "6:15 am"
		},
		"wind": {
			"direction": "170",
			"speed": "22.53",
			"chill": "64"
		}
	}
}