Skip to content

Commit f28d94e

Browse files
committed
script for messaging location
1 parent dbb9917 commit f28d94e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

SmsYourLocation/HowTo.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
<p>this is small python script to send sms to your loved ones....especially for those have very caring mother like mine</p>
3+
<p>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)</p>
4+
<p><b>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....</b></p>
5+
6+

SmsYourLocation/SmsYourLocation.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import urllib3
2+
import json
3+
http = urllib3.PoolManager()
4+
r = http.request('GET', 'http://ipinfo.io/json')
5+
data = json.loads(r.data.decode('utf-8'))
6+
city=data['city']
7+
loc=data['loc']
8+
print(city,loc)
9+
from twilio.rest import Client
10+
11+
client = Client("TWILO SSID", "AUTH TOKEN")
12+
client.messages.create(to="PHONE NO YOU WANT TO SEND SMS",
13+
from_="YOUR TWILLO PHONE NUMBER",
14+
body="hi amma i am in "+city+" now and my cordinates are " +loc)

0 commit comments

Comments
 (0)