I'm new to Python and Flask and I'm trying to do the equivalent of Response.redirect as in C# - ie: redirect to a specific external Domain URL with appending string - how do I go about this?
import os
from flask import Flask
import flask
import urllib
app = Flask(__name__)
# Registers url to run before each request
@app.before_request
def before_request():
return _redirectSSO(flask.request)
def _redirectSSO(reuested_url):
# External Domain SSO URL to authenticate user
url = 'https://ssologon/ssologinconfirm.html?target={0}'.format(urllib.quote_plus(reuested_url))
return flask.redirect(url)
@app.route('/')
def hello():
return "Hello World"
Please standardize/optimize the code, to make it work with out any issues?Thans
Aucun commentaire:
Enregistrer un commentaire