Easy pythonista script to use from dropbox iOS app share sheet to take dropbox link to python script and save it to pythonista filesystem. Also works with "raw" python scripts from github and gists.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|import requests, appex|
|from urllib.parse import urlparse|
|url = appex.get_url().replace("dl=0", "dl=1")|
|r = requests.get(url)|
|filename = urlparse(url).path.rpartition("/")[-1].replace(".py", "-downloaded.py")|
|with open(filename, "wb") as outfile:|
|print("script downloaded as " + filename)|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Could be a seven liner ;-) ...