Created
April 7, 2016 18:29
-
-
Save jnewman/23c993ef50bcd69f9086fcd4e2594928 to your computer and use it in GitHub Desktop.
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
from flask import Flask, make_response | |
app = Flask(__name__) | |
@app.route('/no-space') | |
def no(): | |
return make_response(('Hello', 200, {'Content-Disposition': 'attachment; filename=hello.txt'})) | |
@app.route('/space') | |
def yes(): | |
return make_response(('Hello', 200, {'Content-Disposition': 'attachment; filename = oh-no.txt'})) | |
if __name__ == "__main__": | |
app.run() |
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
Flask==0.10.1 | |
itsdangerous==0.24 | |
Jinja2==2.8 | |
MarkupSafe==0.23 | |
Werkzeug==0.11.5 |
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
#!/usr/bin/env bash | |
pip install -r requirements.pip | |
python main.py & pid=$! | |
echo $pid | |
sleep 5 | |
curl -LOJ 'http://localhost:5000/no-space' | |
stat hello.txt | |
curl -LOJ 'http://localhost:5000/space' | |
stat oh-no.txt | |
kill $pid | |
rm hello.txt space |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To run, do:
Must have python and pip installed.