Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import requests
def citycall(city):
api_key = '' # Our unique key for accessing the api
link = 'https://api.openweathermap.org/data/2.5/weather' # A call which takes the city and outputs data
call = {'APPID': api_key, 'q': city} # Takes the two parameters required by the API
output = requests.get(link, params=call) # Calls the API with the two things it requested as variables
data = output.json() # stores the incoming data
print(data)
print(data['weather'])
print(data['weather'][0]['description']) # Displays incoming data
print(data['wind']['speed'])
def countrycall(country):
api_key = '' # Our unique key for accessing the api
link = 'https://api.openweathermap.org/data/2.5/weather' # A call which takes the city and outputs data
call = {'APPID': api_key, 'q': country} # Takes the three parameters required by the API
output = requests.get(link, params=call) # Calls the API with the two things it requested as variables
data = output.json() # stores the incoming data
x = input("")
citycall(x)