Skip to content

Instantly share code, notes, and snippets.

@maddievision
Created March 4, 2013 02:41
Show Gist options
  • Save maddievision/5079537 to your computer and use it in GitHub Desktop.
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
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