Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

☁️ Python Command-Line Weather App

A concise and functional application built entirely in Python to fetch and display real-time weather data for any major city worldwide.

This project demonstrates core programming concepts including API integration, data parsing (JSON), and error handling, making it a complete portfolio piece.


✨ Features

  • Real-time Data: Fetches up-to-the-minute weather conditions directly from the OpenWeatherMap API.
  • Detailed Metrics: Displays key weather metrics, including:
    • Current Temperature
    • 'Feels Like' Temperature
    • Humidity
    • Atmospheric Pressure
    • Weather Description (e.g., "clear sky," "broken clouds")
  • Interactive CLI: Simple command-line interface (CLI) that prompts the user for a city name and runs continuously until the user types 'exit'.
  • Error Handling: Includes checks for API connection errors and user input errors (e.g., city not found).

🛠️ Technologies Used

Technology Purpose
Python 3 Core language for the application logic.
requests Library used to make HTTP requests to the external API.
OpenWeatherMap API The free web service providing the weather data.
JSON Data format used for receiving and parsing information from the API.

🚀 Getting Started

Follow these steps to run the application on your local machine.

1. Prerequisites

You must have Python 3 installed and the requests library.

# Install the necessary Python library
pip install requests

2. Set up the API Key

You need a free API key from OpenWeatherMap:

  1. Sign up for an account at OpenWeatherMap.

  2. Navigate to the "My API Keys" section to find your key.

  3. Open the weather_app.py file and replace the placeholder text with your actual key:

    # IMPORTANT: Replace 'YOUR_API_KEY' with your actual API key!
    API_KEY = "YOUR_API_KEY"

3. Run the App

Execute the Python script from your terminal:

python weather_app.py

The application will launch and prompt you to enter a city name:

Enter city name (or 'exit' to quit): Paris, France

--- Weather in Paris, France ---
Temperature: 15.2°C
Feels Like: 14.8°C
Humidity: 78%
Pressure: 1012 hPa
Description: Overcast clouds
--------------------------

Enter city name (or 'exit' to quit): 

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages