This is a simple Python command-line tool that fetches and displays the current weather for a user-specified location using the OpenWeatherMap API.
- Get current temperature (in Celsius and Fahrenheit)
- Get current weather conditions (e.g., Clear, Clouds, Rain)
- Get current humidity
- Clone the repository (or download the files).
- Install dependencies:
Make sure you have Python 3 installed.
Navigate to the project directory and install the required
requestslibrary:pip install -r requirements.txt
- Get an OpenWeatherMap API Key:
- Go to https://openweathermap.org/appid
- Sign up for a free account.
- Navigate to the 'API keys' tab on your account page to find your API key.
- Configure the API Key:
- Open the
weather_monitor.pyfile. - Find the line
API_KEY = "YOUR_API_KEY_HERE". - Replace
"YOUR_API_KEY_HERE"with the actual API key you obtained from OpenWeatherMap.
- Open the
Run the script from your terminal:
python weather_monitor.pyThe script will prompt you to enter a city name or zip code.
Enter your city name or zip code: London
Weather in London:
Temperature: 15.0°C / 59.0°F
Conditions: scattered clouds
Humidity: 72%
- Weather data is provided by OpenWeatherMap.
- Temperature is displayed in both Celsius and Fahrenheit.