При попытке поиска населенного пункта в терминале выходит ошибка

Взял код с гитхаба: https://github.com/PavelSkorikov/meteobot.

Ошибка:

Desktop\meteobot-master\main.py", line 47, in search_location
     nf = 'страна: ' + str(w['location']['country']) + '\n' + 'регион: ' + str(w['location']['region']) + '\n' + 'широта: ' + str(w['location']['lat']) 
+ '\n' + 'долгота: ' + str(w['location']['lon']) + '\n' + 'время:' + str(w['location']['localtime'])
 KeyError: 'location'

Думаю, что проблема в этой части, но не уверен:

w = json.loads(response.text)
            nf = 'страна: ' + str(w['location']['country']) + '\n' + 'регион: ' + str(w['location']['region']) + '\n' + 'широта: ' + str(w['location']['lat']) + '\n' + 'долгота: ' + str(w['location']['lon']) + '\n' + 'время:' + str(w['location']['localtime'])
            self.info.text = nf
            for i in range(7):
                d = w['forecast']['forecastday'][i]['date'].replace('-','.')
                self.date[i].text = d[8:10] + d[4:7]
                self.tmax[i].text = str(w['forecast']['forecastday'][i]['day']['maxtemp_c'])
                self.tmin[i].text = str(w['forecast']['forecastday'][i]['day']['mintemp_c'])
                self.wind[i].text = str(w['forecast']['forecastday'][i]['day']['maxwind_mph'])
                self.condition[i].source = 'http:' + str(w['forecast']['forecastday'][i]['day']['condition']['icon'])
                self.totalprecip[i].text = str(w['forecast']['forecastday'][i]['day']['totalprecip_mm'])
                self.avgvis[i].text = str(w['forecast']['forecastday'][i]['day']['avgvis_km'])
                self.avghumidity[i].text = str(w['forecast']['forecastday'][i]['day']['avghumidity'])
                self.voshod[i].text = str(w['forecast']['forecastday'][i]['astro']['sunrise'])
                self.zakat[i].text = str(w['forecast']['forecastday'][i]['astro']['sunset'])

Ответы (0 шт):