A Python command-line weather application that provides weather information for cities in Gujarat state, India. The application stores weather data in a MySQL database for historical tracking.
- 🌤️ Real-time weather data for 25+ Gujarat cities
- 💾 MySQL database storage for weather history
- 📊 View historical weather data
- 🎯 Input validation for Gujarat cities only
- 🖥️ User-friendly command-line interface
- Python 3.7+
- MySQL Server
- OpenWeatherMap API key (free)
-
Clone the repository and navigate to the project directory
-
Run the setup script:
chmod +x setup.sh ./setup.sh
-
Get your free API key from OpenWeatherMap
-
Set up MySQL database and update
.env
file with your credentials:WEATHER_API_KEY=your_api_key_here DB_HOST=localhost DB_USER=your_mysql_username DB_PASSWORD=your_mysql_password DB_NAME=weather_app
-
Activate virtual environment:
source venv/bin/activate
-
Run the application:
python main.py
-
Follow the menu prompts to:
- Get current weather for any Gujarat city
- View weather history
- See list of available cities
The app supports 25+ major cities in Gujarat including: Ahmedabad, Surat, Vadodara, Rajkot, Bhavnagar, Jamnagar, Junagadh, Gandhinagar, Anand, Navsari, Morbi, Mahesana, Bharuch, Vapi, Veraval, Godhra, Patan, Porbandar, Palanpur, Valsad, Nadiad, Surendranagar, Bhuj, Gandhidham, Ankleshwar
Dhruvil-Weather-App/
├── main.py # Main application file
├── weather_api.py # Weather API handler
├── database.py # Database operations
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── setup.sh # Setup script
└── README.md # Project documentation
- Python 3
- MySQL
- OpenWeatherMap API
- Requests library
- MySQL Connector