generate functionThu, 09 Feb 2023

create a python api that gets the current weather of Hargeisa

import requests from datetime import date def main(): url = '' res = requests.get(url) data = res.json() #print(data) city = data['name'] today = temp = data['main']['temp'] humidity = data['main']['humidity'] wind_speed = data['wind']['speed'] weather_description = data['weather'][0]['description'] print('City: {}'.format(city)) print('Temperature: {}'.format(temp)) print('Humidity: {}'.format(humidity)) print('Wind speed: {}'.format(wind_speed)) print('Weather: {}'.format(weather_description)) print('Today is: {}'.

Questions about programming?Chat with your personal AI assistant