python weather

Solutions on MaxInterview for python weather by the best coders in the world

showing results for - "python weather"
Luca
20 Jan 2018
1# importing requests and json
2import requests, json
3# base URL
4BASE_URL = "https://api.openweathermap.org/data/2.5/weather?"
5# City Name CITY = "Hyderabad"
6# API key API_KEY = "Your API Key"
7# upadting the URL
8URL = BASE_URL + "q=" + CITY + "&appid=" + API_KEY
9# HTTP request
10response = requests.get(URL)
11# checking the status code of the request
12if response.status_code == 200:
13   # getting data in the json format
14   data = response.json()
15   # getting the main dict block
16   main = data['main']
17   # getting temperature
18   temperature = main['temp']
19   # getting the humidity
20   humidity = main['humidity']
21   # getting the pressure
22   pressure = main['pressure']
23   # weather report
24   report = data['weather']
25   print(f"{CITY:-^30}")
26   print(f"Temperature: {temperature}")
27   print(f"Humidity: {humidity}")
28   print(f"Pressure: {pressure}")
29   print(f"Weather Report: {report[0]['description']}")
30else:
31   # showing the error message
32   print("Error in the HTTP request")
Benjamin
18 Jun 2016
1import pyowm
2owm = pyowm.OWM()
3observation = owm.weather_at_place('London,uk')
4w = observation.get_weather()
5w.get_wind()
6w.get_humidity()
7################
8# Run
9>>> {u'speed': 3.1, u'deg': 220}
10>>> 76
11
queries leading to this page
weather pythonweather package pythonhow to get the weather using pythonpython get temperatureget current weather in pythonget weather information pythonhow to get weather in pythonuse open weather map api in pythonweather for pythonhow to get weather from weather com in pythonpython weatherhow to use weather api toshow weather in pythonpython weather api scriptget current weather pythonenter a city name temperature 2cwind 2chumidityhow to use openweathermap api pythonhow to check weather of any location using pyhtonget current weather from place pythonpython weather apppython get weathetweather api python examplesusing openweathermap api pythonapi weather pyhtonfind weather pythonopen weather api python examplepython api for weatherpython et weatherget weather in pythonweather api pythonget the weather pythonget weather pyopen weather map api pythonhow to use open weather weather api for pythohow to tell weather using pythonweather api pytohnopen weather code for pythonpython openweathermap apiget weather info using pythonhow to get weather updates using pythonpython get curent weather apihow to read weather using pythonpython get weather openweathermaphow to check weather of any location using pthonpython weather temperaturehow to add weather in pythonshow the weather temperature pypython get weatherweather python apipython api to get weather informationopenweathermap python examplehow to find weather using python without apipython script openweathermapopenweathermap pythonpython get weather datapython code to show temperature near mepython weather packagepython how to import a weatherget weather app pythonopen weather pythonhow to get the weather in pythonhow to check weather of any location using pythonget weather pythonget weather data pythonpython weather librarypython get weather in citypython weather modulehow to get the weather with pythonweather program in pythonpython get wethaeropen weather api pythonweather temperature pythonpython check weathertemperature in pythonweather package for pythonhow to apply python weather api in projectpython get weather informationusing open weather map api pythonhow to get weather data in pythonhow to use open weather api pythontemperature forecast pythonopen weather map py apihow to use open weather api in pythonweather eith pythonweather app pythonweather api python tutorialpython weather forecastpython how to find the wheaterweather api pyton examplespython weather