-
-
Save esprengle/9b8896b2af24c12a148c98250e206e54 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