Shortcuts’ Open X-Callback URL
allows for setting custom callback keys. By setting Success Key
to argv
the success is appended to the call to Pythonista as the last argument. Unfortunately only one of the keys can be set to argv
as only the last one will be appended.
Here’s an example:
from datetime import datetime
import json
from urllib.parse import quote_plus
....
x_success = sys.argv[-1] # shortcuts-production://x-callback-url/ic-success/<UUID>
x_cancel = x_success.replace('ic-success', 'ic-cancel')
x_error = x_success.replace('ic-success', 'ic-error')
x_success += '?x-source=Pythonista3'
x_success += '&result=' + quote_plus({....})
x_success += '&datetime=' + quote_plus(str(datetime.today()))
webbrowser.open(x_success)
Hope this is helpful to someone.
Cheers,