Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97961
| From | John Gordon <gordon@panix.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: working with cookies |
| Date | 2015-10-26 23:14 +0000 |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Message-ID | <n0mc3q$o3j$1@reader1.panix.com> (permalink) |
| References | <b538e4ae-2f64-46b6-ac21-f0959f7cd4a8@googlegroups.com> <n0m1n4$qu7$1@reader1.panix.com> <f4e741a7-f47d-457a-babb-d98d15c9aba3@googlegroups.com> |
In <f4e741a7-f47d-457a-babb-d98d15c9aba3@googlegroups.com> Jeremy Leonard <jrmy.lnrd@gmail.com> writes:
> To setup the cookie I use this code:
> from http import cookies
> from datetime import datetime, timedelta
> cookie = cookies.SimpleCookie()
> cookie["session"] = random.randint(0,100000000000000000)
> cookie["session"]["expires"] = expires.strftime("%a, %d %b %Y %H:%M:%S +0000")
> print(cookie.output())
> To disable the cookie I've only been able to find code to the effect of:
> from http import cookies
> import os
> cookie = cookies.SimpleCookie(os.environ["HTTP_COOKIE"])
> cookie["session"]["expires"]='Thu, 01 Jan 1970 00:00:00 GMT'
> cookie["expires"]='Thu, 01 Jan 1970 00:00:00 GMT'
> print(cookie.output())
> I seem to only be able to find variations of this code.
When your application responds to a client request, the response headers
include the current list of cookies. Cookies are deleted by removing them
from this list.
Where does your application keep track of the cookies it sends to the
client? Are you using a web framework?
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
working with cookies Jeremy Leonard <jrmy.lnrd@gmail.com> - 2015-10-26 12:26 -0700
Re: working with cookies John Gordon <gordon@panix.com> - 2015-10-26 20:16 +0000
Re: working with cookies Jeremy Leonard <jrmy.lnrd@gmail.com> - 2015-10-26 15:57 -0700
Re: working with cookies John Gordon <gordon@panix.com> - 2015-10-26 23:14 +0000
Re: working with cookies Jeremy Leonard <jrmy.lnrd@gmail.com> - 2015-10-26 17:30 -0700
Re: working with cookies John Gordon <gordon@panix.com> - 2015-10-27 01:41 +0000
Re: working with cookies Jeremy Leonard <jrmy.lnrd@gmail.com> - 2015-10-27 05:11 -0700
Re: working with cookies Denis McMahon <denismfmcmahon@gmail.com> - 2015-10-28 08:25 +0000
Re: working with cookies Jeremy Leonard <jrmy.lnrd@gmail.com> - 2015-10-28 12:31 -0700
Re: working with cookies John Gordon <gordon@panix.com> - 2015-10-28 19:47 +0000
csiph-web