🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)
🔧 AI Nachrichten Major AI platforms go down in unprecedented simultaneous outage(03.09.2026 um 17:34 Uhr)
🔧 AI Nachrichten ChatGPT, Claude, and Grok Down? Users Report Widespread Outages(03.09.2026 um 19:14 Uhr)
🔧 AI Nachrichten OpenAI Launches GPT-6 Astra, Says We May Have Entered the AGI Era(03.09.2026 um 22:08 Uhr)
🔧 AI Nachrichten Claude Comes to CarPlay as Fifth Major AI Chatbot App(05.09.2026 um 05:31 Uhr)
🔧 AI Nachrichten OpenAI’s GPT-6 Astra Is AGI, Says NVIDIA CEO Jensen Huang(07.09.2026 um 06:31 Uhr)
🔧 AI Nachrichten Blame AI companies for Mac mini and Mac Studio shortage(31.08.2026 um 10:32 Uhr)

🔧 Programmierung 🕛 kürzlich 3 Min Lesezeit
0

My Project 3: Building a Weather App with Python + Streamlit

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

🌤️ Building a Weather App with Python + Streamlit (Using wttr.in API)




For my next project, I wanted to work with a public API and learn how to fetch external data in Python.
So I built a simple Weather App using wttr.in, which provides weather data without requiring an API key.



This project has two versions:




  • Console Version (weather.py)

  • Streamlit Web Version (weather_streamlit.py)




This small project helped me learn how to make API requests, handle JSON data, and build a clean UI with Streamlit.






🧱 1. Project Overview




The Weather App allows you to:




  • Enter a city name

  • Fetch live weather using wttr.in

  • View temperature, condition, humidity

  • Use it via console or a Streamlit web UI



Simple, clean, and useful — exactly what I want for my Python practice.






📂 Project Structure




weather_app/

├── weather.py # Console version
├── weather_streamlit.py # Streamlit version
└── README.md # (optional)





🌐 2. API Used: wttr.in




I chose wttr.in because it:




  • Requires no signup

  • Returns JSON easily

  • Works well for quick projects






🖥️ 3. Console Version (weather.py)



Key features:




  • Requests weather using requests library

  • Shows temperature, weather description, humidity

  • Gracefully handles errors



📌 Code





CODE
import requests

city = input("Enter city name: ")

url = f"https://wttr.in/{city}?format=j1"
response = requests.get(url)

if response.status_code != 200:
print("Error fetching weather data.")
exit()

data = response.json()

current = data["current_condition"][0]

print("=== Weather Report ===")
print("City:", city)
print("Temperature:", current["temp_C"], "°C")
print("Weather:", current["weatherDesc"][0]["value"])
print("Humidity:", current["humidity"], "%")








🌤️ 4. Streamlit Web Version (weather_streamlit.py)



Why Streamlit?




Because Streamlit turns Python scripts into fast, interactive web apps — perfect for tools like this.



Added features:




  • Clean web UI

  • User-friendly city input

  • Error messages

  • Styled weather data output



📌 Code






CODE
import streamlit as st
import requests

st.title("🌤️ Sabin's Weather App")

city = st.text_input("Enter city name:", "Chur")

if st.button("Check Weather"):
url = f"https://wttr.in/{city}?format=j1"
response = requests.get(url)

if response.status_code != 200:
st.error("Error fetching weather data.")
else:
data = response.json()
current = data["current_condition"][0]

temp = current["temp_C"]
desc = current["weatherDesc"][0]["value"]
humidity = current["humidity"]

st.subheader(f"Weather in {city}")
st.write(f"🌡 Temperature: <strong>{temp}°C</strong>", unsafe_allow_html=True)
st.write(f"☁ Condition: <strong>{desc}</strong>", unsafe_allow_html=True)
st.write(f"💧 Humidity: <strong>{humidity}%</strong>", unsafe_allow_html=True)






python






⚙️ 5. How to Run



✔ Console Version



CODE
python3 weather.py


✔ Streamlit Version



CODE

pip install streamlit
streamlit run weather_streamlit.py


Streamlit will automatically open a browser window for the web UI.







📚 6. What I Learned




  • How to make API requests with requests

  • How to parse JSON responses

  • How to build an interactive UI with Streamlit

  • Error handling for network responses

  • How to convert a console script into a web app







🔧 7. Future Improvements




  • Add weather icons

  • Show hourly + weekly forecast

  • Support multiple languages

  • Add background theme (sunny, cloudy, rainy)

  • Allow saving favorite cities

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
3 Quellen
GPT-6 Astra Release Today? OpenAI’s Next Major AI Model Is Almost Here
1 Quelle
Apple accuses OpenAI of destroying evidence as trade-secrets fight intensifies
1 Quelle
Major AI platforms go down in unprecedented simultaneous outage
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten My Project 3: Building a Weather App with Python + Streamlit

Thematisch verwandte Begriffe: Project, Building, Weather, with · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...