diff --git a/SmsYourLocation/HowTo.md b/SmsYourLocation/HowTo.md new file mode 100644 index 0000000..781859e --- /dev/null +++ b/SmsYourLocation/HowTo.md @@ -0,0 +1,6 @@ + +
this is small python script to send sms to your loved ones....especially for those have very caring mother like mine
+so you can run this script as cron job and it will SMS your currrent location to number you want (note: it should be registered with TWILO)
+NOTE:you need to make a account in twilo. if you are going to use paid one you will have more options like multiple numbers extra....
+ + diff --git a/SmsYourLocation/SmsYourLocation.py b/SmsYourLocation/SmsYourLocation.py new file mode 100644 index 0000000..1541321 --- /dev/null +++ b/SmsYourLocation/SmsYourLocation.py @@ -0,0 +1,14 @@ +import urllib3 +import json +http = urllib3.PoolManager() +r = http.request('GET', 'http://ipinfo.io/json') +data = json.loads(r.data.decode('utf-8')) +city=data['city'] +loc=data['loc'] +print(city,loc) +from twilio.rest import Client + +client = Client("TWILO SSID", "AUTH TOKEN") +client.messages.create(to="PHONE NO YOU WANT TO SEND SMS", + from_="YOUR TWILLO PHONE NUMBER", +body="hi amma i am in "+city+" now and my cordinates are " +loc)