Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57760

Re: Cookie issue(cant fix it with anyhting)

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <benjamin@schollnick.net>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'explicit': 0.07; 'initialize': 0.07; 'cookie': 0.09; 'except:': 0.09; 'hiding': 0.09; 'try:': 0.09; 'benjamin': 0.16; 'check.': 0.16; 'received:192.168.1.20': 0.16; 'subject:issue': 0.16; 'error': 0.23; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'code': 0.31; 'subject:with': 0.35; 'except': 0.35; 'received:google.com': 0.35; 'charset:us-ascii': 0.36; 'skip:o 20': 0.38; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'browser': 0.61; 'you.': 0.62; 'header:Message-Id:1': 0.63; 'url:17': 0.68; 'browser.': 0.78; 'url:posts': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=schollnick.net; s=schollnick; h=sender:from:content-type:message-id:mime-version:subject:date :references:to:in-reply-to; bh=XYryu9NbQfGbOVgef3279oyiwXgwF3GzYQvRReWDF+0=; b=ay7k4YP/ibC+uUuurXjXCDGxqmKx7/ePVUWpVPhCe72j+Q08ra5oEYZy/NjeLeRWGm 4BQxzzd5kfXUXxkz/IE3u8lEtJIdGACqJGFeD1mraECrkNsjKlaESX10y7p61i7rUQSO mrxymzKQO0etl/VWhrHbFmNJfMq6yrvKbSrjo=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:content-type:message-id:mime-version :subject:date:references:to:in-reply-to; bh=XYryu9NbQfGbOVgef3279oyiwXgwF3GzYQvRReWDF+0=; b=jYVhe8tINuyA5k7S4ueUCyvbbmSM6cN8Ku9CMzDSvTfYzFspvvYbrIHYLeUvraLKat VXytIXGNe+8c9NEmKQf4zwNQgDpEsCI7o/0qcOa/L2h5MTfKbyt730obQGxrHQUTFFAm C6NtzrQ2gFxmoVGHeB/FdVjkH8upFvur05NIGuaoTkgoJqxtwVOEtE939cSQ4PtRloUm /GdHAs+3TNH2hNlgHppUixr35uFNrbvqO6BylbGZqtIF5E00GCq5GunuTiLnokjLvPBq 5KJCvyaMrBnt1SC2RUySG/BJ6yAnKEz6iM6YSc/Ol9QqC9MMlm7XLbYzcBcYjHF3q5Rc dHYg==
X-Gm-Message-State ALoCoQkoF3bc4psmHUsjm13biHHptdiDmgMlr7HDne4kR52FaCnb0tTmY4LCQ+YeDv3jK0S8bVIe
X-Received by 10.50.22.67 with SMTP id b3mr5962212igf.39.1382901928928; Sun, 27 Oct 2013 12:25:28 -0700 (PDT)
Sender Benjamin Schollnick <bschollnick@schollnick.net>
From Benjamin Schollnick <benjamin@schollnick.net>
Content-Type multipart/alternative; boundary="Apple-Mail=_F1ACD1D9-7FD4-44A7-9730-54B3B1E43FF2"
Mime-Version 1.0 (Mac OS X Mail 7.0 \(1816\))
Subject Re: Cookie issue(cant fix it with anyhting)
Date Sun, 27 Oct 2013 15:25:23 -0400
References <l4gck0$mkj$1@dont-email.me> <l4jkd7$16b$3@dont-email.me>
To python-list@python.org
In-Reply-To <l4jkd7$16b$3@dont-email.me>
X-Mailer Apple Mail (2.1816)
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.1660.1382902405.18130.python-list@python.org> (permalink)
Lines 58
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382902405 news.xs4all.nl 16001 [2001:888:2000:d::a6]:34631
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57760

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Nikos,

Hello i having the following code to try and retrieve the visitor's
>> saved cookie form the browser.
>> 
>> [CODE]
>> # initialize cookie and retrieve cookie from clients browser try:
>>     cookie = cookies.SimpleCookie( os.environ['HTTP_COOKIE'] )
>>     cookieID = cookie['name'].value
>> except:
>>     cookieID = 'visitor'

As it has been said before, change the except to be an explicit error check.  
The all purpose except is hiding an error condition from you.

Take a look at this:

http://www.jayconrod.com/posts/17/how-to-use-http-cookies-in-python

	- Benjamin


Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Cookie issue(cant fix it with anyhting) Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-26 15:29 +0300
  Re: Cookie issue(cant fix it with anyhting) Chris Angelico <rosuav@gmail.com> - 2013-10-27 00:35 +1100
  Re: Cookie issue(cant fix it with anyhting) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-26 15:48 +0000
  Re: Cookie issue(cant fix it with anyhting) Denis McMahon <denismfmcmahon@gmail.com> - 2013-10-27 18:01 +0000
    Re: Cookie issue(cant fix it with anyhting) Benjamin Schollnick <benjamin@schollnick.net> - 2013-10-27 15:25 -0400
      Re: Cookie issue(cant fix it with anyhting) Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-27 23:17 +0200
    Re: Cookie issue(cant fix it with anyhting) Nick the Gr33k <nikos.gr33k@gmail.com> - 2013-10-27 23:19 +0200

csiph-web