Use x-callback-urls with Pythonistabrowsing

I don't know if this is technically possible, but I think its a great idea. There are many apps in the App Store that implement a concept of inter-app-communication called x-callback-url. This allows some really advanced automation.

The basic idea is that app1 launches app2 with a url scheme that follows the x-callback-url specification. This means that, in addition to the parameters, it twice adds its own url scheme, one time for success callback and once for error.

This would need to be implemented by Pythonista, as the UIApplication -openURL: options: method in the AppDelegate gets called. However, Pythonista could parse any parameters passed into a dictionary and return it from the webbrowser.openURL method.

Example:

Launch Drafts with an url scheme and get the contents of a specific notedrafts4://x-callback-url/get?uuid=UUID-TO-VALID-DRAFT&x-success=YOUR_APP_URL_SCHEME://success
Drafts will fetch the contents of the note and call the x-success url you provided, with a text parameter containing the contents of that note

pythonista doesn't accept x-callback-urls directly, but the script you run from the pythonista url scheme can take a callback arguments. pythonista can, of course call other apps with callbacks, either using pythonista:// (there are a few posts about detecting when the app returns to the foreground), or using the url scheme to run a continuation script.