current_observation dictionary missing in Python for UK location

  • 1
  • Question
  • Updated 5 years ago
I am using the suggested Python to access the API and the result comes back containing location and response dictionaries but no current_observation dictionary. I am using the following location as an example:

http://api.wunderground.com/api//geol...

If I try IA/Cedar_Rapids.json it returns a current_observation

Is it simply that the WeatherUnderground API only works in the US?
Photo of MegaAvalanche

MegaAvalanche

  • 1 Post
  • 0 Reply Likes
  • undecided

Posted 5 years ago

  • 1
Photo of afelicioni

afelicioni

  • 227 Posts
  • 43 Reply Likes
It seems you're missing /conditions/ feature in URL you're using in your code

http://api.wunderground.com/api/__API... would return the following:


{
"response": {
"version":"0.1",
"termsofService":"http://www.wunderground.com/weather/api/d/terms.html",
"features": {
"geolookup": 1
,
"conditions": 1
}
}
, "location": {
"type":"INTLCITY",
"country":"UK",
"country_iso3166":"GB",
"country_name":"United Kingdom",
"state":"",
"city":"London",
"tz_short":"GMT",
"tz_long":"Europe/London",
"lat":"51.47999954",
"lon":"-0.44999999",
"zip":"00000",
"magic":"1",
"wmo":"03772",
"l":"/q/zmw:00000.1.03772",
"requesturl":"global/stations/03772.html",
"wuiurl":"http://www.wunderground.com/global/stations/03772.html",
"nearby_weather_stations": {
"airport": {
"station": [
{ "city":"London / Heathrow Airport", "state":"", "country":"United Kingdom", "icao":"", "lat":"51.47920609", "lon":"-0.45060000" }
,{ "city":"London", "state":"", "country":"UK", "icao":"EGLL", "lat":"51.47750092", "lon":"-0.46138901" }
,{ "city":"Northolt", "state":"", "country":"UK", "icao":"EGWU", "lat":"51.54868317", "lon":"-0.41691700" }
,{ "city":"Farnborough", "state":"", "country":"UK", "icao":"EGLF", "lat":"51.27999115", "lon":"-0.77269602" }
]
}
,
"pws": {
"station": [
{
"neighborhood":"",
"city":"Iver, South Bucks",
"state":"",
"country":"United Kingdom",
"id":"IBUCKSIV1",
"lat":51.504894,
"lon":-0.508861,
"distance_km":4,
"distance_mi":2
},
{
"neighborhood":"Hayes End",
"city":"Hillingdon",
"state":"GREATER LONDON",
"country":"UNITED KINGDOM",
"id":"IGREATER31",
"lat":51.524734,
"lon":-0.433171,
"distance_km":5,
"distance_mi":3
},
{
"neighborhood":"Sunbury on Thames",
"city":"Middlesex",
"state":"UK",
"country":"United Kingdom",
"id":"I90581027",
"lat":51.417065,
"lon":-0.433550,
"distance_km":7,
"distance_mi":4
},
{
"neighborhood":"Hampton Hill",
"city":"Hampton",
"state":"MIDDLESEX",
"country":"UNITED KINGDOM",
"id":"IMIDDLES22",
"lat":51.429050,
"lon":-0.358474,
"distance_km":8,
"distance_mi":5
},
{
"neighborhood":"Shepperton Green",
"city":"Shepperton",
"state":"SURREY",
"country":"UNITED KINGDOM",
"id":"ISURREYS3",
"lat":51.401806,
"lon":-0.461514,
"distance_km":8,
"distance_mi":5
},
{
"neighborhood":"Ruislip",
"city":"Ruislip",
"state":"GREATER LONDON",
"country":"UNITED KINGDOM",
"id":"IGREATER59",
"lat":51.559952,
"lon":-0.397741,
"distance_km":9,
"distance_mi":5
},
{
"neighborhood":"Northolt",
"city":"Northolt",
"state":"ENGLAND",
"country":"UNITED KINGDOM",
"id":"IENGLAND607",
"lat":51.551792,
"lon":-0.372738,
"distance_km":9,
"distance_mi":5
},
{
"neighborhood":"Ruislip Manor",
"city":"United Kingdom",
"state":"",
"country":"UNITED KINGDOM",
"id":"IUNITEDK45",
"lat":51.566509,
"lon":-0.413942,
"distance_km":9,
"distance_mi":5
},
{
"neighborhood":"Weybridge",
"city":"United Kingdom",
"state":"",
"country":"UNITED KINGDOM",
"id":"IUNITEDK67",
"lat":51.377567,
"lon":-0.479029,
"distance_km":11,
"distance_mi":6
},
{
"neighborhood":"Windsor UK",
"city":"Windsor",
"state":"WINDSOR AND MAIDENHEAD",
"country":"UNITED KINGDOM",
"id":"IWINDSOR2",
"lat":51.482342,
"lon":-0.617735,
"distance_km":11,
"distance_mi":6
},
{
"neighborhood":"Sudbury",
"city":"Wembley",
"state":"",
"country":"UNITED KINGDOM",
"id":"IWEMBLEY2",
"lat":51.559895,
"lon":-0.326490,
"distance_km":12,
"distance_mi":7
},
{
"neighborhood":"Chertsey",
"city":"Chertsey",
"state":"ENGLAND",
"country":"UNITED KINGDOM",
"id":"IENGLAND374",
"lat":51.376011,
"lon":-0.512374,
"distance_km":12,
"distance_mi":7
},
{
"neighborhood":"Kingston upon Thames, Surrey UK",
"city":"Kingston Upon Thames",
"state":"ENGLAND",
"country":"UNITED KINGDOM",
"id":"IENGLAND536",
"lat":51.420559,
"lon":-0.289599,
"distance_km":12,
"distance_mi":7
},
{
"neighborhood":"Hersham",
"city":"Walton-on-Thames",
"state":"Surrey",
"country":"United Kingdom",
"id":"ISURREYW12",
"lat":51.365776,
"lon":-0.408288,
"distance_km":13,
"distance_mi":7
},
{
"neighborhood":"Thames Ditton, Surrey",
"city":"Thames Ditton",
"state":"",
"country":"UNITED KINGDOM",
"id":"ITHAMESD2",
"lat":51.382801,
"lon":-0.334375,
"distance_km":13,
"distance_mi":8
},
{
"neighborhood":"Surbiton",
"city":"Surbion",
"state":"SURREY",
"country":"UNITED KINGDOM",
"id":"ISURREYS7",
"lat":51.398445,
"lon":-0.301911,
"distance_km":13,
"distance_mi":8
},
{
"neighborhood":"Harrow",
"city":"Harrow",
"state":"GREATER LONDON",
"country":"UNITED KINGDOM",
"id":"IGREATER48",
"lat":51.591576,
"lon":-0.335255,
"distance_km":14,
"distance_mi":8
},
{
"neighborhood":"Burnham Slough",
"city":"Slough",
"state":"ENGLAND",
"country":"UNITED KINGDOM",
"id":"IENGLAND503",
"lat":51.528252,
"lon":-0.648691,
"distance_km":14,
"distance_mi":8
},
{
"neighborhood":"Northwood",
"city":"London",
"state":"MIDDLESEX",
"country":"UNITED KINGDOM",
"id":"IMIDDLES21",
"lat":51.614792,
"lon":-0.418510,
"distance_km":15,
"distance_mi":9
},
{
"neighborhood":"BRAGGS OF SURBITON",
"city":"Berrylands, Surbiton",
"state":"SURREY",
"country":"United Kingdom",
"id":"ISURREYS1",
"lat":51.389900,
"lon":-0.283300,
"distance_km":15,
"distance_mi":9
},
{
"neighborhood":"Berrylands (Norton Avenue)",
"city":"Kingston Upon Thames",
"state":"",
"country":"UNITED KINGDOM",
"id":"IKINGSTO4",
"lat":51.389317,
"lon":-0.278624,
"distance_km":15,
"distance_mi":9
},
{
"neighborhood":"Berrylands Parkside",
"city":"Kingston Upon Thames",
"state":"GREATER LONDON",
"country":"UNITED KINGDOM",
"id":"IGREATER43",
"lat":51.391754,
"lon":-0.273848,
"distance_km":15,
"distance_mi":9
},
{
"neighborhood":"Burnham, Bucks UK",
"city":"Burnham",
"state":"ENGLAND",
"country":"UNITED KINGDOM",
"id":"IENGLAND174",
"lat":51.527870,
"lon":-0.664260,
"distance_km":15,
"distance_mi":9
}
]
}
}
}
, "current_observation": {
"image": {
"url":"http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png",
"title":"Weather Underground",
"link":"http://www.wunderground.com"
},
"display_location": {
"full":"London, United Kingdom",
"city":"London",
"state":"",
"state_name":"United Kingdom",
"country":"UK",
"country_iso3166":"GB",
"zip":"00000",
"magic":"1",
"wmo":"03772",
"latitude":"51.47999954",
"longitude":"-0.44999999",
"elevation":"24.00000000"
},
"observation_location": {
"full":"London, ",
"city":"London",
"state":"",
"country":"UK",
"country_iso3166":"GB",
"latitude":"51.47750092",
"longitude":"-0.46138901",
"elevation":"79 ft"
},
"estimated": {
},
"station_id":"EGLL",
"observation_time":"Last Updated on March 23, 10:20 AM GMT",
"observation_time_rfc822":"Sun, 23 Mar 2014 10:20:00 +0000",
"observation_epoch":"1395570000",
"local_time_rfc822":"Sun, 23 Mar 2014 10:52:22 +0000",
"local_epoch":"1395571942",
"local_tz_short":"GMT",
"local_tz_long":"Europe/London",
"local_tz_offset":"+0000",
"weather":"Scattered Clouds",
"temperature_string":"46 F (8 C)",
"temp_f":46,
"temp_c":8,
"relative_humidity":"66%",
"wind_string":"From the WNW at 13 MPH",
"wind_dir":"WNW",
"wind_degrees":300,
"wind_mph":13,
"wind_gust_mph":0,
"wind_kph":20,
"wind_gust_kph":0,
"pressure_mb":"1006",
"pressure_in":"29.71",
"pressure_trend":"0",
"dewpoint_string":"36 F (2 C)",
"dewpoint_f":36,
"dewpoint_c":2,
"heat_index_string":"NA",
"heat_index_f":"NA",
"heat_index_c":"NA",
"windchill_string":"41 F (5 C)",
"windchill_f":"41",
"windchill_c":"5",
"feelslike_string":"41 F (5 C)",
"feelslike_f":"41",
"feelslike_c":"5",
"visibility_mi":"6.2",
"visibility_km":"10.0",
"solarradiation":"--",
"UV":"3","precip_1hr_string":"-9999.00 in (-9999.00 mm)",
"precip_1hr_in":"-9999.00",
"precip_1hr_metric":"--",
"precip_today_string":"0.00 in (0.0 mm)",
"precip_today_in":"0.00",
"precip_today_metric":"0.0",
"icon":"partlycloudy",
"icon_url":"http://icons-ak.wxug.com/i/c/k/partlycloudy.gif",
"forecast_url":"http://www.wunderground.com/global/stations/03772.html",
"history_url":"http://www.wunderground.com/history/airport/EGLL/2014/3/23/DailyHistory.html",
"ob_url":"http://www.wunderground.com/cgi-bin/findweather/getForecast?query=51.47750092,-0.46138901"
}
}