for item in tar: tar.extract(item, extract_path) if item.name.find(".tgz") != -1 or item.name.find(".tar") != -1: extract(item.name, "./" + item.name[:item.name.rfind('/')]) def extractZip(zip_url, extract_path='.'): print zip_url zip_ref = zipfile.ZipFile(zip_url, 'r') zip_ref.extractall(extract_path) zip_ref.close() # should not be here @api.route('/api/process', methods=['GET']) def api(): archive=request.args.get('archive') workers=request.args.get('workers') unpackArchive(archive) @api.route('/web/process', methods=['GET']) def web(): archive=request.args.get('archive') workers=request.args.get('workers') unpackArchive(archive) user = "******" return render_template('index.html', title='Lander', user=user) if __name__ == '__main__': api.run(debug=True)
#!/usr/bin/python from papi import api api.run(debug=True, port=5001)