A simple Python script that checks the upcoming weather forecast using the OpenWeatherMap API and sends an email reminder if rain is expected.
- Fetches weather forecast based on your coordinates.
- Checks for rain conditions in the next few hours.
- Sends an automatic email reminding you to take an umbrella.
- Uses OpenWeatherMap API and SMTP (Gmail supported).
- Python 3.x
requestslibrary- An OpenWeatherMap API key
- A Gmail account with an app password
- Clone the repository
- pip install requests.
- Set up your environment variables
- fill your credentials directly in the script:
- api_key = "YOUR_OPENWEATHERMAP_API_KEY"
- USER = "your_email@gmail.com"
- PASSWORD = "your_app_password"
- Run the script : main.py
- Weather condition codes below 700 usually indicate rain or similar precipitation.
- Use a scheduler (like cron or Windows Task Scheduler) to automate this script daily.
- Never share your email password or API key. Use environment variables or .env files, and add .env to your .gitignore if pushing to GitHub.
- MIT License