Skip to content Skip to sidebar Skip to footer

Redirecting To A Url With POST Data Using Python Bottle

Is there any way of adding POST data when redirecting to another page? I've built a service that will redirect the user back to whatever page is specified when the service is calle

Solution 1:

You may build the response, instead of using the redirect(url) method of bottle

from bottle import route, run, response

@post('/wrong')
def wrong():
  response.status = 303
  response.set_header('Location', '/hello')
  return '"key":"val"'  # Enter the body here

@route('/hello')
def hello():
  return "Hello World!"

run(host='0.0.0.0', port=8080, debug=True)

Post a Comment for "Redirecting To A Url With POST Data Using Python Bottle"