मैं बोतल में अपनी प्रतिक्रिया का HTTP स्टेटस कोड कैसे सेट करूं?बोतल में HTTP स्थिति कोड सेट करना?
from bottle import app, run, route, Response
@route('/')
def f():
Response.status = 300 # also tried `Response.status_code = 300`
return dict(hello='world')
'''StripPathMiddleware defined:
http://bottlepy.org/docs/dev/recipes.html#ignore-trailing-slashes
'''
run(host='localhost', app=StripPathMiddleware(app()))
आप देख सकते हैं, उत्पादन HTTP स्थिति कोड मैं सेट वापस नहीं करता है:
$ curl localhost:8080 -i
HTTP/1.0 200 OK
Date: Sun, 19 May 2013 18:28:12 GMT
Server: WSGIServer/0.1 Python/2.7.4
Content-Length: 18
Content-Type: application/json
{"hello": "world"}
बोतल आयात प्रतिक्रिया से 'करता है; response.status = 300' काम? http://bottlepy.org/docs/dev/api.html#bottle.response – dm03514
हां, यह चाल है। धन्यवाद :) –