Automatic raining alert project with Python
Introduction: This simple python project alerts you if it will rain in the next defined hour. All you have to do is sign up openweather API and Twilio messaging service and replace your API key below. CODE: import requests as w import datetime import os from twilio.rest import Client END_POINT = "https://api.openweathermap.org/data/2.5/onecall" api_key = "enter_your_weather_api_key_here" long = "83.995590" lat = "28.237988" account_sid = "your_twilio_account_sid" auth_token = "your_twilio_auth_token" twilo_ph = "twilo_phone_no" client = Client(account_sid, auth_token) api_param = { "lat" : lat, "lon" : long, "appid" : api_key } response = w.get(END_POINT, params=api_param, ).json() weather = response[ "hourly" ][:13] is_raining = False for weather_data in weather: condition_code = weather_data[ "weather" ][0][ "id" ] if condition_code ...