Giter Club home page Giter Club logo

rain-alert's Introduction

Rain SMS Notification System

Overview

Checks the weather for a specific location using the OpenWeatherMap API and sends a notification via SMS through Twilio if rain is forecasted within the next 12 hours.

Features

  • Fetches weather data from OpenWeatherMap onecall API.
  • Checks the forecast for rain in the next 12 hours.
  • Sends an SMS alert if rain is expected.

Requirements

  1. Clone the repository.
  2. Account and API key from OpenWeatherMap
  3. An account, a verified phone number, and API credentials (SID and Auth Token) from Twilio.

Setup

  1. Rename api_keys.py.example to api_keys.py and fill in your Twilio and OpenWeatherMap API keys.
  2. Modify config.py with your preferred settings, including your phone numbers and the coordinates for your location.

Files

  • api_keys.py: Stores your Twilio and OpenWeatherMap API keys. (Ensure this file is kept secure and not shared publicly.)
  • config.py: Contains configuration settings like phone numbers and geographic coordinates for weather checks.
  • weather_service.py: Handles the interaction with the OpenWeatherMap API to fetch weather data.
  • notification_service.py: Manages sending SMS notifications through Twilio.
  • main.py: The entry point for the application, orchestrating the weather check and sending notifications if necessary.

Running the Application

This can be added in Python Anywhere for automated alerts or run locally.

To run locally, navigate to the source directory and in terminal:

export OWM_API_KEY="your key"; export TWILIO_AUTH_TOKEN="your key"; TWILIO_ACCOUNT_SID="your key"; python3 main.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.