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
requests
libraryjson
libraryConfidential
module (containing theAPI_KEY
variable)prettytable
librarycolorama
library
- 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 York
Temperature (°C): 20.53
Humidity (%): 70
Description: Partly cloudy
Wind Speed (m/s): 5.26
Visibility (km): 16.09
This project is licensed under the MIT License.