omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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.


    Use x-callback-urls with Pythonista

    Pythonista
    x-callback url schemes
    2
    3
    7758
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lukaskollmer
      lukaskollmer last edited by

      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 note
        drafts4://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
      1 Reply Last reply Reply Quote 0
      • JonB
        JonB last edited by

        this can be done and has been done. see for example
        https://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/

        you can just use webbrowser.open, no need for objc.

        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.

        1 Reply Last reply Reply Quote 0
        • lukaskollmer
          lukaskollmer last edited by

          @JonB I know, but I want to access the data other apps send back with the url scheme. I wrote a script that basically adds app-wide x-callback-url support to Pythonista

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Powered by NodeBB Forums | Contributors