Built to order

Python Weather App with OpenWeatherMap API and 5-Day Forecast

This project builds a Python desktop weather app that looks up live weather for any city through the OpenWeatherMap API, showing current conditions, a 5-day forecast in 3-hour steps, an hourly strip, favourite cities and severe-weather alerts. Built with Python, Tkinter and the requests library, it keeps the API key in a separate configuration file so the key never ships inside the code. It fetches fresh data on every search instead of storing history. Suitable for B.E./B.Tech final-year projects in Computer Science, Information Technology and Computer Engineering.

Chat on WhatsApp — get a quotation

Computer / IT PythonTkinterrequestsGitOpenWeatherMap 5-day forecast APIOpenWeatherMap Geocoding APIJSONpython-dotenv API key configSoftware
Python Weather App with OpenWeatherMap API and 5-Day Forecast — project thumbnail preview
More project photos (2)

The problem

Checking the weather still means opening a browser, typing the same city name into a search box, and scrolling past advertisements and unrelated stories just to find today's temperature and whether it will rain in the evening. A Python weather app with the OpenWeatherMap API and a 5-day forecast solves this by putting the whole answer in one desktop window: type a city name once and the app shows the current temperature, feels-like value, humidity, wind, pressure and visibility, plus a 5-day forecast built from 3-hour steps and an hourly strip for the next 24 hours. Severe-weather alerts appear as a banner at the top, and favourite cities are one click away, so the cities a student checks every morning open instantly. Because the app fetches live data on every search, the numbers on screen are the latest forecast, not a stored copy.

This is a live-lookup app, not a weather data logger. A data logger polls on a schedule and stores readings in a database so charts can be drawn from history; this app keeps no history at all — every search calls the OpenWeatherMap Geocoding API to resolve the city and the 5-day forecast endpoint to fetch fresh data, then displays it and discards it. Students who want stored history and charts should pick the Desktop Weather Data Logger instead; students who want instant answers for any city should pick this app.

SYSTEM FLOW

5 components 4 connections

Live flow
Drag to explore
100%
userStudent types city

City name in the search box

Follow the working sequence

How it works

A city name typed into the search box starts a short chain of API calls that ends in a full weather window. First the app calls the OpenWeatherMap Geocoding API, which turns the typed name into latitude, longitude, country and state, and shows the matches so the user picks the right place. Then it calls two forecast endpoints with those coordinates: /data/2.5/weather for current conditions and /data/2.5/forecast for the 5-day outlook, a list of 40 timestamps spaced 3 hours apart. The app parses the JSON, groups the 40 slots into 5 days, computes each day's high, low and highest rain chance from its 8 slots, and hands the results to the Tkinter interface, which draws the current-weather panel, the hourly strip, the five day cards and the alert banner. A short cache keeps each city's result for ten minutes, so repeated searches stay inside the free tier's 60-calls-per-minute limit.

  1. The user types a city name and the app calls the OpenWeatherMap Geocoding API, which returns matching places with latitude, longitude, country and state.
  2. The user picks the correct match from the list, so same-name cities in different countries or states are never confused.
  3. The app calls /data/2.5/weather for current conditions and /data/2.5/forecast for the 5-day forecast, passing the coordinates and the API key with units=metric.
  4. The forecast JSON is parsed: each of the 40 timestamps carries temperature, feels-like temperature, humidity, pressure, wind speed and rain probability (pop).
  5. The 40 slots are grouped by calendar day; each day's high and low are computed from its 8 slots and its rain chance is the highest pop among them.
  6. Tkinter renders the current-weather panel, the 8-slot hourly strip for the next 24 hours, the five day cards and the alert banner from the parsed data.
  7. Favourite cities and recent searches are saved to a local JSON file, and the °C/°F toggle re-renders all temperatures without a new API call.
  8. Failures are handled in plain language: unknown city, no internet, an invalid key, or a 429 rate-limit response each shows its own message and the last good result stays on screen.

Tech stack:

  • Python 3.10 or later
  • Tkinter (standard library GUI)
  • requests library for HTTP calls
  • OpenWeatherMap 5-day forecast API
  • OpenWeatherMap Geocoding API
  • JSON data handling
  • python-dotenv · API key configuration
  • Git
Parameter Value
Current weather endpoint OpenWeatherMap /data/2.5/weather
5-day forecast endpoint OpenWeatherMap /data/2.5/forecast (3-hour steps)
Forecast timestamps per search 40 (5 days × 8 slots of 3 hours)
Free-tier limit 60 calls per minute (OpenWeatherMap free tier)
Search response time Approximately 1–2 s on a typical broadband connection (expected)
Hourly strip 8 slots covering the next 24 hours
Favourite cities Up to 10 saved cities (design target)
Cache 10 min per city, to stay inside the free-tier limit (design target)
Platforms Windows · macOS · Linux (Python 3.10 or later)
Internet Required for every lookup (live API data)
API key Free OpenWeatherMap key required

Project features

The Python weather app is built around four capabilities that cover the whole task: city search with disambiguation so a typed name resolves to the right place on Earth; a current-weather panel with temperature, feels-like, humidity, wind, pressure, visibility and sunrise/sunset; a 5-day forecast assembled from the API's 40 three-hour timestamps, with each day's high and low computed from its own 8 slots; and a severe-weather alert banner that surfaces warnings before the forecast cards. Around those four sit the everyday comforts — favourite cities, recent searches, an hourly strip for the next 24 hours, and a one-click Celsius/Fahrenheit switch that re-renders without another API call. The favourites list and the unit switch cost no API calls at all, and every failure — an unknown city, no internet, an invalid key — is explained in plain language instead of crashing the app.

  • [City search with disambiguation] Type any city name and the app queries the OpenWeatherMap Geocoding API, listing matches with country and state so "Pune" never silently becomes the wrong Pune; picking a match starts the forecast lookup.
  • [Current weather panel] Shows temperature, feels-like temperature, humidity, wind speed and gusts, pressure, visibility and sunrise/sunset for the selected city, all from the /data/2.5/weather endpoint.
  • [5-day forecast from 40 timestamps] The /data/2.5/forecast endpoint returns 40 timestamps at 3-hour steps; the app groups them into 5 days and computes each day's high, low and highest rain chance from its 8 slots.
  • [Hourly strip for the next 24 hours] The first 8 forecast slots are shown as an hourly strip with temperature, condition icon and rain chance, so the next day's plan is visible at a glance.
  • [Severe-weather alert banner] When the API returns an alert for the region, a banner at the top of the window states the warning and its valid hours; with no alert the banner stays hidden.
  • [Favourite cities and recent searches] Up to 10 favourite cities (design target) are saved in a local JSON file with one-click reopening, and the last searches are listed below them.
  • [Celsius/Fahrenheit toggle] A °C/°F switch converts every temperature on screen instantly, including the demo dataset, without spending another API call.
  • [Plain-language error handling] An unknown city, missing internet, invalid API key or rate-limit response each produces a short message explaining the cause and the fix, instead of a crash or an empty window.

What is included

  • Complete Python source code (Tkinter app plus a separate API client module)
  • Single-file working demo UI (the WeatherNow demo used for the screenshots)
  • Setup guide: creating a free OpenWeatherMap key, storing it safely in a .env file, and running the app
  • Project report PDF (background, API design, JSON parsing logic, methodology, results)
  • PPT presentation for final review
  • Viva Q&A preparation document (REST APIs, JSON parsing, the Tkinter event loop, rate limits)
  • Project abstract PDF

Limitations & prerequisites

  • Needs an internet connection and a valid free OpenWeatherMap API key; without either, no weather data loads.
  • Forecasts are model outputs, not measurements — a forecast can differ from the weather that actually happens.
  • The free tier allows 60 calls per minute, so rapid repeated searches can hit the rate limit; the app caches each city's result for 10 min (design target).
  • City search can return several places with the same name; the user must pick the correct country/state match.
  • Alert content depends on what OpenWeatherMap returns for the region; some regions carry no alert feed.
  • The app stores no history — past weather cannot be reviewed or charted (that is the data-logger project's job).
  • The screenshots use sample demo data, not live API responses.

Frequently Asked Questions

Is this project suitable for a final-year project?

Yes, for Computer Science, Information Technology and Computer Engineering students. It demonstrates REST API integration, JSON parsing, GUI design with Tkinter, configuration handling for API keys, and honest error handling — five concepts a viva panel can probe one by one. The build is small enough to finish in a semester and complete enough to demo live: type any city, and the panel sees current weather, the 5-day forecast and alerts appear in seconds.

How is this different from a weather data logger?

A weather data logger polls on a fixed schedule and stores every reading in a database so charts can be drawn from history, while this app keeps no history at all and fetches fresh data on every search. The logger answers "what was the weather last week"; this app answers "what is the weather in this city right now, and what will it be for five days". Pick the logger for stored history and charts, and pick this app for instant live answers for any city.

Do I need an API key, and is it free?

Yes, you need a free OpenWeatherMap API key, and creating one costs nothing. Sign up on openweathermap.org, copy the key from the dashboard, and paste it into the .env file that ships with the project; the key is never written inside the source code. The free tier allows 60 calls per minute, which is far more than a single user needs, and the app caches each city's result for 10 min to stay well inside it.

What does the 5-day forecast actually contain?

The forecast endpoint returns 40 timestamps, one every 3 hours for 5 days, and each timestamp carries temperature, feels-like temperature, humidity, pressure, wind speed and rain probability. The app groups the 40 slots into 5 days and computes each day's high, low and highest rain chance from that day's 8 slots, so every number on the day cards traces back to the API response. The first 8 slots also feed the hourly strip for the next 24 hours.

Does it work without internet?

No, every weather lookup needs an internet connection because the data comes live from the OpenWeatherMap API, not from any file on the computer. Without a connection the app shows a plain message instead of stale numbers, and the last good result stays visible on screen. Only the favourites list, recent searches and the unit setting are stored locally in a JSON file, so those still work offline.

Can it be customized?

Yes, the most common additions are an air-quality panel from the OpenWeatherMap Air Pollution API, a weather-map view, more favourite cities, a system-tray icon, and a 16-day forecast on a paid plan. The API client is a separate module, so a new endpoint is added in one place and the Tkinter interface picks it up. College-specific requirements such as a different default city or a report format change are also possible.

Components & software requirements
  • Python 3.10 or later
  • Tkinter (standard library GUI)
  • requests library for HTTP calls
  • OpenWeatherMap 5-day forecast API
  • OpenWeatherMap Geocoding API
  • JSON data handling
  • python-dotenv · API key configuration
  • Git
Delivery information

Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.

Support terms

Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.

Download free synopsis (PDF)

Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.

Get a quotation