Search code examples
pythonyahoo-apiweather-api

Yahoo weather api is it only for United State's cities!??


I'm able to find weather report of cities of US and I want to extend it for the cities in India. It will be still better if I could do it for all the cities in the world. This is the code i was using.

import pywapi
import string

yahoo_result = pywapi.get_weather_from_yahoo('RSXX0199', 'metric')

print "Yahoo says: It is " + string.lower(yahoo_result['condition']['text']) + " and " + yahoo_result['condition']['temp'] + "C now in New York.\n\n"`

I'm not able to find a code for Indian states, cities codes, for which i can replace with RSXX0199. By the way, I'm using Python API for weather, which internally uses Yahoo's weather API.

Please help me out.

Thank you.


Solution

  • If you look at the RSS feed of an individual location, the identifier you are looking for is in it's address.

    For instance, Karimnagar, India's RSS feed is "weather.yahooapis.com/forecastrss?p=INXX0358&u=f" and can be retrieved by clicking the RSS button in the top right.