Created
July 8, 2014 17:12
-
-
Save myles/da733c02e3ee407c9e97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
import urllib | |
import clipboard | |
import webbrowser | |
data = urllib.urlopen('http://ifconfig.me/all.json') | |
ifconfig = json.loads(data.read()) | |
ip_addr = ifconfig.get('ip_addr', '127.0.0.1') | |
arg = sys.argv | |
if len(arg) == 2: | |
if arg[1] == "1": | |
# Drafts | |
webbrowser.open("drafts://x-callback-url/create?text=" + urllib.quote(ip_addr)) | |
elif arg[1] == "2": | |
# iMessage | |
webbrowser.open("launch://messaging?body=" + urllib.quote(ip_addr)) | |
elif arg[1] == "3": | |
webbrowser.open("launch://email?subject=" + urllib.quote("My IP address") + "&body=" + urllib.quote(ip_addr)) | |
else: | |
webbrowser.open("launch:") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment