diff --git a/weather_openweathermap.py b/weather_openweathermap.py index f78e9ec..6e0bfa8 100644 --- a/weather_openweathermap.py +++ b/weather_openweathermap.py @@ -165,9 +165,9 @@ def get_city_by_name(city_name: str) -> City: with open("city.list.json", "r") as city_list_file: city_data = city_list_file.read() city_json = json.loads(city_data) - city_list = list(filter(lambda x: x['name'] == city_name, city_json)) + city_list = list(filter(lambda x: x['name'].casefold() == city_name.casefold(), city_json)) if len(city_list) == 0: - city_list = list(filter(lambda x: (x['name'].find(city_name)) != -1, city_json)) + city_list = list(filter(lambda x: (x['name'].casefold().find(city_name.casefold())) != -1, city_json)) if len(city_list) == 0: return City(cid=-1, name="none", lat=0, lon=0) return City(cid=city_list[0]['id'], name=city_list[0]['name'], lat=city_list[0]['coord']['lat'],