Day 11 of 100 Days Coding Challenge: Python
Let’s talk weather. Today’s project is a Python weather app using the OpenWeatherMap API—because there’s nothing like stepping out in a parka when it’s 80 degrees and sunny. I wanted a tool that would tell me if the sky is smiling or sobbing.
My goal? Get the current weather description (like “clear sky” or “air you can drink”), temperature in both Celsius and Fahrenheit (because I live in Celsius and my husband lives in Fahrenheit—we’ve agreed to disagree), and humidity (mostly for hair-related decisions). If this app could avoid one argument about overdressing, it would already be worth it.
Today’s Motivation / Challenge
The motivation was simple: make a useful, real-world app that doesn’t just live in the land of console output. Also, this was the perfect excuse to play with an API and brush up on Python’s ability to talk to the internet like a well-mannered bot. Plus, nothing says “grown-up developer” like a weather app you built yourself.
Purpose of the Code (Object)
This program lets you type in a city name and then fetches the current weather for that location. It displays the weather description, temperature in both Celsius and Fahrenheit, and the humidity. It’s a lightweight, beginner-friendly way to explore APIs, data handling, and basic user interaction with Python. No fancy dashboards, just solid weather facts.
AI Prompt: Make it cleaner
Create a simple Python weather checker using the OpenWeatherMap API. It should take a city name as input and return weather description, temperature in Celsius and Fahrenheit, and humidity. Keep it beginner-friendly and avoid unnecessary complexity. Please make the code for the GUI.
Functions & Features
- Fetches real-time weather for any city using OpenWeatherMap API
- Displays weather description, temperature (°C and °F), and humidity
- Supports basic error handling (invalid city names, bad API keys, etc.)
Requirements / Setup
- Python 3.x
- requests library
pip install requests
Minimal Code Sample
response = requests.get(f”https://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_KEY}&units=metric”)
data = response.json()
temp_c = data[‘main’][‘temp’]
temp_f = (temp_c * 9/5) + 32
This little stretch of code is like your personal weather butler. First, it knocks on OpenWeatherMap’s digital door and politely asks, “Excuse me, what’s the weather like in [city] today?” Then it grabs the answer, digs into the juicy details, and pulls out the temperature in Celsius. But wait—because not everyone lives in metric harmony—it whips out its calculator and converts it into Fahrenheit, just in case someone in the household insists on imperial drama.
Notes / Lessons Learned
I got the code, ran it… 401 error. Unauthorized. Rude. I copied the API key. I pasted it into my browser like so:
https://api.openweathermap.org/data/2.5/weather?q=Chicago&appid={API key}
Still 401. I stripped the key just in case it was haunted by invisible characters:
API_KEY = “your_api_key”.strip()
Nada.
Then I tried curl from the command line like a tech-savvy detective:
curl “https://api.openweathermap.org/data/2.5/weather?q=Chicago&appid={API_KEY}&units=metric”
And BOOM—it worked!
Turns out my API key hadn’t activated yet. (Yes, that’s a thing. No, I didn’t read the fine print. Yes, I will next time. Maybe.)
Once the key was activated, I plugged it into my app and voilà—weather at my fingertips.
Optional Ideas for Expansion
- Add a simple GUI with tkinter
- Show weather-based icons or descriptions (e.g., “Bring an umbrella” for rain)
- Include a 3-day forecast by upgrading to the OpenWeatherMap One Call API

