Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #56210
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <andipersti@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.032 |
| X-Spam-Evidence | '*H*': 0.94; '*S*': 0.00; 'initialize': 0.07; 'received:192.168.178': 0.07; 'cookie': 0.09; 'andreas': 0.16; 'bye,': 0.16; 'received:192.168.178.20': 0.16; 'subject:fails': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'url:python': 0.33; 'received:google.com': 0.35; 'url:org': 0.36; 'skip:o 20': 0.38; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'url:3': 0.61; 'url:http': 0.64; '8bit%:100': 0.72; 'subject:get': 0.81; 'explanation:': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=wfTX7qn7XuZmYV1ptjXCD/jI0IodSYVeE+Oz84gMW9o=; b=xgSKbrqDuphWWVACbKYQ6OSgCtdjep8HkAI81/IIRmXm2tmEKCygAeI1oHjVmpIOsB pcm78jLJyy7Nj8mvTJs7Mnot8AeVszx1IKmeYM+lgmBuX3cpC/UVeWk94NEgJNj0TC0H L8UxS7L0+g/UPIzMotG3zAldDjFCg6Eq1d2AuuUFg1b8UvRsEyzWQmxCuCe4L1d4ykb7 ISCt7zDb0OeY9Q4ZfhVpkJLbrMk8wT5nidy01DgU1JGf8yQiek0UFaCn7Ej3m0KbHBhF DAmisQ2rVmd8l7KGS8QKJ3iorl//6G5g5CEqLwdKlD1Y4gwok7LuyzpP6SwfKs+HClYW WocQ== |
| X-Received | by 10.205.65.17 with SMTP id xk17mr18317678bkb.19.1380992203385; Sat, 05 Oct 2013 09:56:43 -0700 (PDT) |
| Date | Sat, 05 Oct 2013 18:56:41 +0200 |
| From | Andreas Perstinger <andipersti@gmail.com> |
| User-Agent | Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Select fails when cookie tried to get a numeric value |
| References | <l2p4o4$4ht$1@dont-email.me> <mailman.744.1380981591.18130.python-list@python.org> <l2p7ef$j06$1@dont-email.me> |
| In-Reply-To | <l2p7ef$j06$1@dont-email.me> |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.756.1380992210.18130.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380992210 news.xs4all.nl 15894 [2001:888:2000:d::a6]:39950 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:56210 |
Show key headers only | View raw
On 05.10.2013 16:24, Νίκος Αλεξόπουλος wrote:
> # initialize cookie
> cookie = cookies.SimpleCookie( os.environ.get('HTTP_COOKIE') )
> cookie.load( cookie )
Watch:
>>> cookie1 = cookies.SimpleCookie('ID=42')
>>> cookie1.load(cookie1)
>>> print(cookie1)
Set-Cookie: ID="Set-Cookie: ID=42"
>>> cookie1.get('ID').value
'Set-Cookie: ID=42'
And now watch this:
>>> cookie2 = cookies.SimpleCookie('ID=42')
>>> print(cookie2)
Set-Cookie: ID=42
>>> cookie2.get('ID').value
'42'
Explanation:
http://docs.python.org/3/library/http.cookies.html#http.cookies.BaseCookie.load
>>> c = cookies.SimpleCookie('ID=42')
>>> isinstance(c, dict)
True
>>> c.items()
dict_items([('ID', <Morsel: ID='42'>)])
Bye, Andreas
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 16:38 +0300
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 09:53 -0400
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 17:40 +0300
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 10:54 -0400
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 11:12 -0400
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 18:31 +0300
Re: Select fails when cookie tried to get a numeric value Andreas Perstinger <andipersti@gmail.com> - 2013-10-05 17:47 +0200
Re: Select fails when cookie tried to get a numeric value Chris Angelico <rosuav@gmail.com> - 2013-10-06 09:36 +1100
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 18:52 +0300
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 12:08 -0400
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 19:14 +0300
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 19:17 +0300
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 12:42 -0400
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 19:53 +0300
Re: Select fails when cookie tried to get a numeric value Zero Piraeus <z@etiol.net> - 2013-10-05 12:06 -0300
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 18:50 +0300
Re: Select fails when cookie tried to get a numeric value Chris Angelico <rosuav@gmail.com> - 2013-10-05 23:59 +1000
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 17:24 +0300
Re: Select fails when cookie tried to get a numeric value Chris Angelico <rosuav@gmail.com> - 2013-10-06 00:28 +1000
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 17:30 +0300
Re: Select fails when cookie tried to get a numeric value Ned Batchelder <ned@nedbatchelder.com> - 2013-10-05 10:43 -0400
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 17:47 +0300
Re: Select fails when cookie tried to get a numeric value Zero Piraeus <z@etiol.net> - 2013-10-05 11:44 -0300
Re: Select fails when cookie tried to get a numeric value MRAB <python@mrabarnett.plus.com> - 2013-10-05 17:51 +0100
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 17:28 +0300
Re: Select fails when cookie tried to get a numeric value Andreas Perstinger <andipersti@gmail.com> - 2013-10-05 18:56 +0200
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-05 20:38 +0300
Re: Select fails when cookie tried to get a numeric value Benjamin Rovny <rdr.vladimir@gmail.com> - 2013-10-05 09:35 -0500
Re: Select fails when cookie tried to get a numeric value Terry Reedy <tjreedy@udel.edu> - 2013-10-05 18:06 -0400
Re: Select fails when cookie tried to get a numeric value Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-05 23:36 +0000
Re: Select fails when cookie tried to get a numeric value Νίκος Αλεξόπουλος <nikos.gr33k@gmail.com> - 2013-10-06 08:20 +0300
Re: Select fails when cookie tried to get a numeric value Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-06 14:57 +0000
Re: Select fails when cookie tried to get a numeric value Piet van Oostrum <piet@vanoostrum.org> - 2013-10-06 22:16 -0400
csiph-web