Skip to content

Commit 0523b16

Browse files
committed
flask session test
1 parent a8023a0 commit 0523b16

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

23_flask_session_test.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import sys
2+
from flask import Flask, session, url_for, redirect
3+
4+
app = Flask(__name__)
5+
app.secret_key = 'secret'
6+
7+
8+
@app.route('/')
9+
def set():
10+
session.clear()
11+
session['works'] = True
12+
return redirect(url_for('get'))
13+
14+
15+
@app.route('/get')
16+
def get():
17+
works = session.get('works', False)
18+
return str(works)
19+
20+
21+
app.run(sys.argv[1], use_reloader=False)

readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@
2121
1. **19_tsv-to-csv.py**: Convert TSV to CSV
2222
1. **20_restore_file_from_git.py**: Restore file from Git History
2323
1. **21_twitter_bot.py**: Twitter Bot
24-
1. **22_git_tag.py**: Create Git Tag based on a commit
24+
1. **22_git_tag.py**: Create Git Tag based on a commit
25+
1. **23_flask_session_test.py**: Just a simple app to see if the sessions are working.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy