This command-line tool accepts a city's name as input and returns the current weather forecast. It utilizes the OpenWeatherMap API to fetch weather data and parses it using Python. The solution demonstrates how GitHub Copilot can assist with API usage, data parsing, and error handling.
- Python 3.x
requestslibraryjsonlibraryConfidentialmodule (containing theAPI_KEYvariable)prettytablelibrarycoloramalibrary
- Clone the repository:
git clone https://github.com/CrutoSJ/Techgig_Hackathon.git
- Install the required dependencies:
pip install -r requirements.txt
- Set up OpenWeatherMap API Key:
-
Obtain an API key from OpenWeatherMap.
-
Create a file named Confidential.py in the same directory as the script.
-
Add the following line to Confidential.py, replacing YOUR_API_KEY with your actual API key:
API_KEY = "YOUR_API_KEY"
- Run the script:
python weather_forecast.py
-
Enter the name of the city for which you want to retrieve the weather forecast when prompted.
-
View the current weather forecast displayed in a table format, including temperature, humidity, description, wind speed, and visibility.
- Example Output:
Enter the city name: New York
City: New YorkTemperature (°C): 20.53Humidity (%): 70Description: Partly cloudyWind Speed (m/s): 5.26Visibility (km): 16.09
This project is licensed under the MIT License.