protect psycopg script from sql injection?

Peter Otten __peter__ at web.de
Thu Jun 26 05:49:33 EDT 2014


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.






More information about the Python-list mailing list