Skip to content

Instantly share code, notes, and snippets.

@jlehikoinen
Last active September 8, 2023 05:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save jlehikoinen/ebbb77b366d908243ad6 to your computer and use it in GitHub Desktop.
Save jlehikoinen/ebbb77b366d908243ad6 to your computer and use it in GitHub Desktop.
"""
setup_example.py
Run this script from the Pythonista Documents root
Setup script for https://github.com/jlehikoinen/pythonista-flask-example
"""
import requests
import zipfile
import urllib
import tempfile
###
# Download and extract GitHub repo zip
print 'Downloading and extracting pythonista-flask-example.zip..'
zip_url = 'https://github.com/jlehikoinen/pythonista-flask-example/archive/master.zip'
try:
with tempfile.NamedTemporaryFile(mode='w+b',suffix='.zip') as f:
urllib.urlretrieve(zip_url, f.name)
local_zip = zipfile.ZipFile(f)
local_zip.extractall()
except Exception as e:
print 'Error: ' + str(e)
print('Download failed')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment