Cookies − dictionary object holding Cookie names and values
def setcookie()
make_response()
get() of request.cookies

example:

vi templates/cookie.html

<html>
   <body>

      <form action = "/setcookie" method = "POST">
         <p><h3>Enter userID</h3></p>
         <p><input type = 'text' name = 'Name'/></p>
         <p><input type = 'submit' value = 'Login'/></p>
      </form>

   </body>
</html>
vi cookie.py
from flask import Flask, render_template, request, make_response
ap = Flask(__name__)

@ap.route('/cookie')
def cookie():
   return render_template('cookie.html')

@ap.route('/setcookie', methods = ['POST', 'GET'])
def setcookie():
   if request.method == 'POST':
       user = request.form['Name']

   resp = make_response(render_template('readcookie.html'))
   resp.set_cookie('userID', user)

   return resp

@ap.route('/getcookie')
def getcookie():
   name = request.cookies.get('userID')
   return '<h1>Hello '+name+'</h1>'

if __name__ == '__main__':
   ap.run(host= '0.0.0.0')
vi templates/readcookie.html
<html>
   <body>

     <a href="http://<ip>:5000/getcookie">Enter</a>

   </body>
</html>
python cookie.py