HTTP is a stateless protocol, each request has no knowledge of any requests previously executed

This greatly simplifies client/server communication, however the web app usually needs a way to store data between each request as a user interacts with the app itself

Code Implementation:

from flask import Flask, session, jsonify
 
app = Flask(__name__)
 
@app.route("/")
def index():
	session['name'] = "Ayush is cool"
 
@app.route("/get_session_name", methods=['GET'])
def get_name():
	if session['name']:
		return jsonify({'return': session['name']})
 
if __name__ == '__main__':
	app.run()