From 59a294dc2b6d3321187381cbb81ad619df150d6f Mon Sep 17 00:00:00 2001 From: MannyCano_ <38194701+TheManik@users.noreply.github.com> Date: Sun, 11 Oct 2020 20:44:20 -0400 Subject: [PATCH 1/2] Weather Text Initial weather text app --- weather_text/weather_text.py | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 weather_text/weather_text.py diff --git a/weather_text/weather_text.py b/weather_text/weather_text.py new file mode 100644 index 0000000..a76a640 --- /dev/null +++ b/weather_text/weather_text.py @@ -0,0 +1,37 @@ +import requests +import json +import os + +from twilio.rest import Client + + +api_key = os.environ['API_KEY'] +base_url = os.environ['BASE_URL'] + +zip_code = input("Enter your Zip code: ") +region = input("Enter your region: ") +complete_url = base_url + "zip=" + zip_code + "," + region + "&appid=" + api_key +response = requests.get(complete_url) +x = response.json() + +if x["cod"] != "404" : + y = x["main"] + current_temp = y["temp"] + +conversion_temp = (current_temp - 273.15) * 9/5 + 32 + +account_sid = os.environ['TWILIO_SID'] +auth_token = os.environ['AUTH_TOKEN'] +client = Client(account_sid, auth_token) + +numFrom = input("Enter your number: ") +numTo = input("Enter your sender number: ") + + +message = client.messages \ + .create( + body="Temperature is: " + str(conversion_temp), + from_=numFrom, + to= numTo + ) +print(message.sid) From 92014af335c36a20dcbb712c83490228bb66fae8 Mon Sep 17 00:00:00 2001 From: MannyCano_ <38194701+TheManik@users.noreply.github.com> Date: Sun, 11 Oct 2020 20:46:23 -0400 Subject: [PATCH 2/2] Create README.md --- weather_text/README.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 weather_text/README.md diff --git a/weather_text/README.md b/weather_text/README.md new file mode 100644 index 0000000..7e650eb --- /dev/null +++ b/weather_text/README.md @@ -0,0 +1,28 @@ +# WeatherTextApp +Using Twilio & Openweather API + +## Table of contents +* [General info](#general-info) +* [Technologies](#technologies) +* [Setup](#setup) + +## General info +This project is a simple Weather App that sends you a text according to the location specified. + +## Technologies +Project is created with: +* Twilio +* OpenWeather + + +## Setup +To run this project, git pull into a directory and run the script. +Setup a Cron job if you want it to run every Morning before you wake up, just remember to hard-code: +* Zip Code +* Region +* From Number +* To Number + +``` +$ python3 weatherapp.py +```