csparpa / pyowm

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

state/country mismatch for toponyms generated by locations_for method #335

Closed Darumin closed 4 years ago

Darumin commented 4 years ago

Not sure if this is something that needs attention:

locations_for() method in CityIdRegistry returns a list of Location objects with toponyms.

However, it isn't always a "city, country" stored in Location object. For every US state, it returns the state instead of the country.

Similarly, this doesn't seem to match weather_at_place() under weather manager. If you try using this method with a "city, us state" query, you won't get results.

Please let me know if there's something I'm missing. Thank you.

Darumin commented 4 years ago

I discovered that this is the nature of the OpenWeather API, not necessarily a bug. Lookups with the format "city name, US state, country" do work here, but "city name, US state" alone will not work.

csparpa commented 4 years ago

@Darumin well done! thanks for investing in this