Tristan Kohl
2015-07-02 19:39:54 UTC
Hello guys,
I am toying around with bottle for quite a while now (managed to get Bottle
subapps running, etc.) and made myself some great tools but up until now I
am not capable to use the Response and Request objects properly.
I think the blame is on me, but even if I return a Response object which is
instantiated with i.e. status code 400, Bottle returns status code 200.
My code is something like this:
####
from bottle import Response
if SOME_CONDITION_LEADING_TO_PROBLEM:
res = Response(body=SOME_ERROR_DESC, status=400, header=xyz)
return res
####
Now I start a test run with curl, which should raise the condition above:
####
curl -i -H "Content-Type: application/json" -X GET -d
'{"func":"get","data":"xyz", "args":["xyz", "xyz"]}' http://127.0.0.1:12000/
####
But I always get something like this:
####
HTTP/1.0 200 OK <---- This is not, what I want
Date: Thu, 02 Jul 2015 19:22:00 GMT
Server: WSGIServer/0.2 CPython/3.4.3
blablabla...
####
I am pretty sure there is something I am doing wrong but I do not have a
clue what that might be. Similar problems rise with the Request object
which I don't know how to use :(((
Help is very much appreciated!
Cheers,
Tristan
@Marcel: awesome peace of software :)
--
I am toying around with bottle for quite a while now (managed to get Bottle
subapps running, etc.) and made myself some great tools but up until now I
am not capable to use the Response and Request objects properly.
I think the blame is on me, but even if I return a Response object which is
instantiated with i.e. status code 400, Bottle returns status code 200.
My code is something like this:
####
from bottle import Response
if SOME_CONDITION_LEADING_TO_PROBLEM:
res = Response(body=SOME_ERROR_DESC, status=400, header=xyz)
return res
####
Now I start a test run with curl, which should raise the condition above:
####
curl -i -H "Content-Type: application/json" -X GET -d
'{"func":"get","data":"xyz", "args":["xyz", "xyz"]}' http://127.0.0.1:12000/
####
But I always get something like this:
####
HTTP/1.0 200 OK <---- This is not, what I want
Date: Thu, 02 Jul 2015 19:22:00 GMT
Server: WSGIServer/0.2 CPython/3.4.3
blablabla...
####
I am pretty sure there is something I am doing wrong but I do not have a
clue what that might be. Similar problems rise with the Request object
which I don't know how to use :(((
Help is very much appreciated!
Cheers,
Tristan
@Marcel: awesome peace of software :)
--
--
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You are member of the "bottlepy" group at google groups.
See http://groups.google.de/group/bottlepy for mailing list options.
See http://bottlepy.org/ for news and documentation.
---
You received this message because you are subscribed to the Google Groups "bottlepy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bottlepy+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.