Created
March 4, 2013 02:41
-
-
Save maddievision/5079537 to your computer and use it in GitHub Desktop.
Very simple wrapper for Drafts URL scheme for Pythonista http://omz-software.com/pythonista
This file contains hidden or 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 urllib | |
import webbrowser | |
URL_BASE = "drafts://x-callback-url/create?" | |
CALLBACK_URL_BASE = "pythonista://" | |
def do_action(actiontype,txt,cb=CALLBACK_URL_BASE): | |
surl = URL_BASE + 'text=' + urllib.quote(txt) + '&action=' + urllib.quote(actiontype) + '&x-success=' + urllib.quote(cb) | |
webbrowser.open(surl) | |
print "Action Complete" | |
def message(txt,cb=CALLBACK_URL_BASE): | |
do_action('Message',txt,cb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment