There are several applications that require OpenWeather APIs for their underlying functions.
This Answer will walk us through the important steps we must follow to get the OpenWeather API key.
To get the OpenWeather API key, we must follow the steps below:
Click here to open the OpenWeather website.
Click the “Sign in” button, as shown below:
A new page opens. If you already have an account on the website, enter your credentials. Otherwise, click the “Create an Account” option.
Please add your API key in the api_key field. Click the "Run" button to test whether the API key is valid.
import requestsimport jsonimport osapi_key = os.environ["API_Key"]url = 'http://api.openweathermap.org/data/2.5/weather?q=london&appid=' + api_keyresponse = requests.get(url)if response.status_code == 200:print('Wohoo! Setup complete!\n\nWe are good to go!')elif response.status_code == 429:print('Your account is temporary blocked due to exceeding of requests limitation of your subscription type. Please choose the proper subscription http://openweathermap.org/price')else:print(f'{response.status_code}: {response.reason}')
Free Resources