Create a Weather app using Flask | Python Last Updated : 17 Sep, 2019 Comments Improve Suggest changes Like Article Like Report Prerequisite : Flask installation Flask is a lightweight framework written in Python. It is lightweight because it does not require particular tools or libraries and allow rapid web development. today we will create a weather app using flask as a web framework. this weather web app will provide current weather updates of cities searched. Basic setup : Create a file and name it as weather.py Linux command to create a file touch weather.py Now, create a folder templates with a file name index.html Linux command to create a folder and a file mkdir templates && cd templates && touch index.html The project folder will look like : Editing files : Use your own API key from Weather API and place it in API variable. Now edit weather.py file. Python3 1== from flask import Flask, render_template, request # import json to load JSON data to a python dictionary import json # urllib.request to make a request to api import urllib.request app = Flask(__name__) @app.route('/', methods =['POST', 'GET']) def weather(): if request.method == 'POST': city = request.form['city'] else: # for default name mathura city = 'mathura' # your API key will come here api = api_key_here # source contain json data from api source = urllib.request.urlopen('http://api.openweathermap.org/data/2.5/weather?q =' + city + '&appid =' + api).read() # converting JSON data to a dictionary list_of_data = json.loads(source) # data for variable list_of_data data = { "country_code": str(list_of_data['sys']['country']), "coordinate": str(list_of_data['coord']['lon']) + ' ' + str(list_of_data['coord']['lat']), "temp": str(list_of_data['main']['temp']) + 'k', "pressure": str(list_of_data['main']['pressure']), "humidity": str(list_of_data['main']['humidity']), } print(data) return render_template('index.html', data = data) if __name__ == '__main__': app.run(debug = True) Navigate to templates/index.html and edit it: link to the index file. Now you can run the server to see the weather app - python weather.py Comment More infoAdvertise with us Next Article Create a Weather app using Flask | Python itsvinayak Follow Improve Article Tags : Python Web Technologies HTML CSS Web technologies +1 More Practice Tags : python Similar Reads Weather app using Django | Python Our task is to create a Weather app using Django that lets users enter a city name and view current weather details like temperature, humidity, and pressure. We will build this by setting up a Django project, creating a view to fetch data from the OpenWeatherMap API, and designing a simple template 2 min read Building A Weather CLI Using Python Trying to know the weather is something that we all do, every day. But have you ever dreamed of making a tool on your own that can do the same? If yes, then this article is for you. In this article, we will look at a step-by-step guide on how to build a Weather CLI using OpenWeather API. What is Ope 4 min read Create a Weather App with Forecast using React-Native React-Native is an open-source framework used to develop cross-platform applications i.e., you can write code in React-Native and publish it as an Android or IOS app. In this article, we will build a weather app using React-Native. The app contains two features:Getting the current weather of a given 5 min read Weather App in Python using Tkinter module In this article, we are going to discuss how to create a weather app using tkinter. The GUI app will tell us the current weather of a particular city along with temperature details along with other details. Modules required:Tkinter: It is a built-in python library for making GUI using tkinter toolk 4 min read Python | Build a REST API using Flask Prerequisite: Introduction to Rest API REST stands for REpresentational State Transfer and is an architectural style used in modern web development. It defines a set or rules/constraints for a web application to send and receive data. In this article, we will build a REST API in Python using the Fla 3 min read Flask project - Create a Joke App with PyJokes Flask is a micro web framework written in Python. It is classified as a micro-framework because it does not require particular tools or libraries. Flask is a lightweight WSGI web application framework. It is designed to make getting started quick and easy, with the ability to scale up to complex app 2 min read How to Run a Flask Application After successfully creating a Flask app, we can run it on the development server using the Flask CLI or by running the Python script. Simply execute one of the following commands in the terminal:flask --app app_name runpython app_nameFile StructureHere, we are using the following folder and file.Dem 4 min read Create a Real Time Currency Converter app using Flask | Python Prerequisite:  installation  of  PythonWhat is Flask in Python ? Flask is a popular and lightweight Python web framework, meaning it is a third-party Python library used for developing web applications. Project Setup : create a new directory and name it 'CURRENCY-CONVERTER'. mkdir CURRENCY-CONVERTER 8 min read Form Submission API with Swagger Editor and Python Flask Creating user-friendly APIs is essential for seamless interaction between applications. Leveraging tools like Swagger Editor alongside Python Flask, developers can streamline the process of designing, documenting, and implementing APIs. In this guide, we'll explore how to craft a Form Submission API 3 min read Create a Real-Time Weather Forecast App with React Real-time weather forecast app with React involves integrating with a weather API to fetch weather data and display it in the UI. Individuals can use the app to check the current weather conditions, temperature, humidity, and other relevant weather data for their location or any city they are intere 5 min read Like