Skip to content

Instantly share code, notes, and snippets.

@santosh
Created November 2, 2017 07:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santosh/2f79b49693d21a5db76caf003714c1d4 to your computer and use it in GitHub Desktop.
Save santosh/2f79b49693d21a5db76caf003714c1d4 to your computer and use it in GitHub Desktop.
Set cookies in flask. #Flask #Python
from flask import Flask, request, make_response, redirect
app = Flask(__name__)
@app.route('/')
def index():
response = make_response('<h1>This document carries a cookie!</h1>')
response.set_cookie('answer', '42')
return response
if __name__ == '__main__':
app.run(debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment