Python Flask Send Raw HTTP Header Response
Kalau di PHP, Anda pasti mengenal fungsi
Dari web PHP docs, fungsi ini untuk mengirim raw http header. Bagaimana melakukan hal tersebut di python Flask?
Done
header("Location": "someurl")
Dari web PHP docs, fungsi ini untuk mengirim raw http header. Bagaimana melakukan hal tersebut di python Flask?
from flask import make_response
from app import app
@app.route("/")
def index():
resp = make_response()
resp.location = "http://someurl"
resp.status = "301"
return resp
Done
Comments
Post a Comment