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.
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: | |
outfile.write(r.content) | |
print("script downloaded as " + filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Could be a seven liner ;-) ...