Код: Выделить всё
import requests
import configparser
def get_api_key():
config = configparser.ConfigParser()
config.read('config.ini')
return config['openweathermap']['api']
def get_weather_results(zip_code, country_code, api_key):
api_url = 'http://api.openweathermap.org/data/2.5/weather?zip={},{}&appid={}'.format(zip_code, country_code, api_key)
r = requests.get(api_url)
return r.json()
print(get_weather_results("GU27PG", "UK", get_api_key()))
Код: Выделить всё
{'cod': '404', 'message': 'city not found'}
Буду очень признателен за любую помощь
Подробнее здесь: https://stackoverflow.com/questions/676 ... eather-map
Мобильная версия