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.
URL Scheme to Return to Safari
-
Hi: I've got an action extension through the Workflow App that calls and runs the following URL-shortening (via Bitly) Pythonista script:
import requests import json import clipboard import webbrowser import console LongURL = str(clipboard.get()) query_params = {'access_token' : 'MYTOKEN', 'longUrl' : str(clipboard.get())} endpoint = 'https://api-ssl.bitly.com/v3/shorten' response = requests.get(endpoint, params= query_params) data = json.loads(response.content) if data['status_code'] != 500: clipboard.set(data['data']['url']) webbrowser.open('safari-'+LongURL) if data['status_code'] == 500: alert = console.alert('URL already shortened!', 'Return to Safari?', 'Safari', hide_cancel_button=True) if alert == 0: webbrowser.open('safari-'+LongURL)
Is there a URL scheme that will just open Safari in iOS to the last opened tab/page? That is, I currently can't figure out a way to return to Safari after running the Pythonista action without telling Safari to open either a blank page or a specific page (in this case, the initial URL that I shortened, to prevent my returning to Safari from counting as a link view).
I've tried
safari-http://a
to see if that would work, to no avail. Any help is appreciated!