Weather CLI (API)

Welcome to the Weather CLI (API) page.

This page contains a brief description and implementation instructions for the project.

Project Description

A command-line program that fetches current weather data for a given city using a web API (e.g. OpenWeatherMap). The user enters a city name, and the program displays temperature, humidity, conditions, etc. For example, one GfG solution shows how to use requests to get JSON from OpenWeatherMap.

Project Requirements

Python 3.x, requests library (install via pip), and an API key for a weather service like OpenWeatherMap.

How to Run the Project

  1. Register with a weather API (e.g. OpenWeatherMap) to get an API key.
  2. Write a script (e.g. weather.py) that uses requests.get() to call the API endpoint and parses the JSON response.
  3. Run it: python weather.py. Enter a city when prompted; the program outputs weather details.

Key Concepts Learned

Possible Extensions

Troubleshooting & Debugging

See Troubleshooting & Debugging.

← Back to Python Programming Page