csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
791 stars 175 forks source link

station_at_coords is broken #167

Closed csparpa closed 7 years ago

csparpa commented 7 years ago

Affects: PyOWM 2.6

When executing:

owm.station_at_coords(51.5073509, -0.1277583, 2)

the StationParser crashes:

ParseResponseError: Exception in parsing OWM web API response
Reason: pyowm.webapi25.stationparser: unable to read JSON data

This is the JSON payload of the API response:

{  
   u'info':{  
      u'formatversion':2,
      u'type':1,
      u'channal':u'METAR_GDP'
   },
   u'distance':12.672,
   u'station':{  
      u'status':50,
      u'name':u'EGLC',
      u'zoom':9,
      u'coord':{  
         u'lat':51.5053,
         u'lng':0.0553
      },
      u'type':1,
      u'id':5091
   },
   u'last':{  
      u'main':{  
         u'pressure':1025,
         u'temp':285.15,
         u'humidity':76
      },
      u'clouds':[  
         {  
            u'distance':579,
            u'condition':u'SCT'
         },
         {  
            u'distance':1372,
            u'condition':u'BKN'
         }
      ],
      u'visibility':{  
         u'distance':10000,
         u'prefix':1
      },
      u'dt':1482495600,
      u'calc':{  
         u'humidex':285.55,
         u'dewpoint':281.15
      },
      u'wind':{  
         u'var_end':260,
         u'deg':220,
         u'speed':7.7,
         u'var_beg':190
      }
   }
}
csparpa commented 7 years ago

Fixed with 63a7464d534f48e1d8276146ed8442d90303e6a4