This Python script fetches current weather data from the OpenWeatherMap API based on the user's input of a city name.
It then displays the weather information and writes it to a text file.
- Make sure you have Python installed on your system.
- Obtain an API key from OpenWeatherMap by signing up for an account.
- Clone or download the script
weatherfForecast.py
. - Install the required libraries using
pip install -r requirements.txt
. - Run the script using a Python interpreter.
- Enter the name of the city for which you want to get the weather forecast when prompted.
- The script will display the weather information on the console and save it to a text file
weatherForecast.txt
.
requests
: For making HTTP requests to the OpenWeatherMap API.datetime
: For working with date and time.
To use this script, you need an API key from OpenWeatherMap. Replace the placeholder api_key
in the script with your actual API key.
This project is licensed under the MIT License - see the LICENSE file for details.