Skip to content

Instantly share code, notes, and snippets.

@luhn
Last active January 1, 2016 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luhn/8089645 to your computer and use it in GitHub Desktop.
Save luhn/8089645 to your computer and use it in GitHub Desktop.
Pyramid cookies
request.response.set_cookie('my_cookie', None)
# OR
request.response.unset_cookie('my_cookie')
my_cookie = request.cookies['my_cookie']
from datetime import timedelta as TimeDelta
# Set ``my_cookie`` to ``foobar`` and store for 2 weeks.
request.response.set_cookie('my_cookie', 'foobar', expires=TimeDelta(14))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment