mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
script for messaging location
This commit is contained in:
parent
dbb9917e42
commit
f28d94eb11
6
SmsYourLocation/HowTo.md
Normal file
6
SmsYourLocation/HowTo.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
<p>this is small python script to send sms to your loved ones....especially for those have very caring mother like mine</p>
|
||||
<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>
|
||||
<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>
|
||||
|
||||
|
14
SmsYourLocation/SmsYourLocation.py
Normal file
14
SmsYourLocation/SmsYourLocation.py
Normal file
|
@ -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)
|
Loading…
Reference in New Issue
Block a user