File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change
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
+
Original file line number Diff line number Diff line change
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 )
You can’t perform that action at this time.
0 commit comments