DisasterAlertMailer is a Python-based application that tracks weather alerts and sends emergency notifications via email. It uses the WeatherAPI to fetch weather alerts and the Gmail API to send emails. The device's location is determined using the ipinfo.io
service.
- Features
- Installation
- Configuration
- Usage
- Contributing
- License
- 🌍 Location Tracking: Automatically tracks the device's location using
ipinfo.io
. - 🌦️ Disaster Alerts: Fetches alerts from WeatherAPI.
- 📧 Email Notifications: Sends emergency alerts via Gmail.
- ⏰ Scheduler: Checks for disasters every 15 minutes (adjustable).
-
Clone the repository:
git clone https://github.com/yourusername/DisasterAlertMailer.git cd DisasterAlertMailer
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Create a
.env
file in the root directory and add the following:FROM_EMAIL=your-email@gmail.com TO_EMAIL=recipient-email@gmail.com WEATHERAPI_KEY=your-weatherapi-key CLIENT_SECRET_FILE=client_secret.json
-
Add your Google OAuth2 credentials: Download your
client_secret.json
from the Google Cloud Console and place it in the root directory.
- FROM_EMAIL: The email address from which alerts will be sent.
- TO_EMAIL: The recipient email address for alerts.
- WEATHERAPI_KEY: Your API key for WeatherAPI.
- CLIENT_SECRET_FILE: The path to your Google OAuth2 client secret file.
-
Run the application:
python dm.py
-
The application will start and check for weather alerts every 15 minutes. If an alert is found, an email will be sent to the specified recipient.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Made with ❤️ by Aloukik Joshi