Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
X-Callbacks
-
Is is possible to call ‘pythonista://...’ and get it to return data in the callback. I know that I can use pythonista to get data say from Workflow app, but is it possible the other way around?
-
Don't know if it's still working... Workflow
-
Hi, yes you can' the trick if your using workflow is to use a custom x-success callback that is "args" which will allow pythonista to return the value.
here is a sample pythonista script that will return a result to workflow.io
#!/usr/bin/env python # workflow.py import sys,json,urllib from datetime import datetime import console,webbrowser,clipboard def main(): console.clear() console.set_font('Menlo',12) console.set_color(1,1,1) #print json.dumps(sys.argv, indent=4) dtf = '%Y-%m-%d %H:%M:%S' output = dict( when=datetime.now().strftime(dtf), args=sys.argv ) result = json.dumps(output,indent=4) print(result) x_callback=sys.argv[-1] if not '://' in x_callback: return url = x_callback + '?argv=' + urllib.quote(result) webbrowser.open(url) if __name__ == '__main__': main()
and to call is use this x-callback-url request
pythonista://workflow.py?action=run&argv=1&argv=2
Here is a dropbox link to a workflow.io flow that uses the above pythonista workflow.py code.
workflow.io to pythonista.py
Cheers Dave.