Purpose: remove the cookie. This option does not work:

datenow = datetime.datetime.now() setcookie = "Set-cookie: {0}={1}; {2}={3}".format('name','value','expires',datenow) 

    1 answer 1

    At a minimum, you need the correct time format ( sane-cookie-date ) for the Expires attribute to use :

     >>> from email.utils import formatdate >>> formatdate(usegmt=True) 'Sun, 08 May 2016 20:01:48 GMT' 

    To create cookies you can use http.cookies.SimpleCookie , sample code .