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


Groups > comp.lang.python > #73614

Re: protect psycopg script from sql injection?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'except:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'try:': 0.09; 'python': 0.11; "'bad": 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'traceback.': 0.16; 'url:file': 0.16; 'url:py': 0.16; 'wrote:': 0.18; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'post': 0.26; 'header:X-Complaints-To:1': 0.27; 'code': 0.31; 'coded': 0.31; 'informative': 0.31; 'yourself.': 0.31; 'url:python': 0.33; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'no,': 0.35; 'but': 0.35; 'subject:?': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'remove': 0.60; 'tell': 0.60; 'back': 0.62; 'complete': 0.62; 'information': 0.63; 'here': 0.66; 'why?': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Peter Otten <__peter__@web.de>
Subject Re: protect psycopg script from sql injection?
Date Thu, 26 Jun 2014 11:49:33 +0200
Organization None
References <CAHByMH0PZKRrie3co9JSUhfr-VufCxO-Jy1K42tAjGvt2mifYg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Gmane-NNTP-Posting-Host p57bd9603.dip0.t-ipconnect.de
User-Agent KNode/4.11.5
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.11255.1403776190.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1403776190 news.xs4all.nl 2922 [2001:888:2000:d::a6]:49821
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:73614

Show key headers only | View raw


celati Laurent wrote:

> I coded this following python script via psycopg;
> 
> web_service_test.py
> <http://python.6.x6.nabble.com/file/n5062113/web_service_test.py>
> 
> 1/ When i execute it, the result is 'bad resquest'. Could you tell me why?

No, but you might find out yourself. When you remove the overly broad

try:
    ... # code that may fail
except:
    print "Bad request"

and just keep the code in the try suite


... # code that may fail

Python will produce an informative traceback. In the (unlikely) case that 
with that extra information you still cannot find the problem in your code 
come back here and post the complete traceback.


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


Thread

Re: protect psycopg script from sql injection? Peter Otten <__peter__@web.de> - 2014-06-26 11:49 +0200

csiph-web