Yahoo Weather API

For some time ago, I did make a small wrapper for the yahoo weather API. I did this because Google closed their API, which was used by a lot of people. But the Yahoo weather API is not so easy to deal with, because they require you to provide the woeid (Where On Earth IDentifier). This means you actually need to do 2 calls, first to their database containing the woeid’s and then afterwards their forecast API.

They had a json version, to get the weather, but Yahoo also decided to close this one. So they only provide an XML version now.

To make it easy, I’ve created a small wrapper for their API, which makes it simple to get the weather, in json format.

To get the weather in Amsterdam it’s as easy as calling following URL:

You can call any city you like, even supply things like IATA or supplying country as well.

But how does it actually work?

The wrapper is written in Python, using UWSGI with nginx as a proxy. It uses the Flask framework.

What it does is to get the value from the URL, search in their database, call their RSS forecast, convert the XML to json, and return it back to you.

I hope it will be useful!