diff --git a/23_flask_session_test.py b/23_flask_session_test.py new file mode 100644 index 0000000..9142760 --- /dev/null +++ b/23_flask_session_test.py @@ -0,0 +1,21 @@ +import sys +from flask import Flask, session, url_for, redirect + +app = Flask(__name__) +app.secret_key = 'secret' + + +@app.route('/') +def set(): + session.clear() + session['works'] = True + return redirect(url_for('get')) + + +@app.route('/get') +def get(): + works = session.get('works', False) + return str(works) + + +app.run(sys.argv[1], use_reloader=False) diff --git a/readme.md b/readme.md index 711370b..2e3022d 100644 --- a/readme.md +++ b/readme.md @@ -21,4 +21,5 @@ 1. **19_tsv-to-csv.py**: Convert TSV to CSV 1. **20_restore_file_from_git.py**: Restore file from Git History 1. **21_twitter_bot.py**: Twitter Bot -1. **22_git_tag.py**: Create Git Tag based on a commit \ No newline at end of file +1. **22_git_tag.py**: Create Git Tag based on a commit +1. **23_flask_session_test.py**: Just a simple app to see if the sessions are working. \ No newline at end of file