Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

python - 如何使用Flask和Python重定向到外部URL并更改请求标头中的Referer(How can redirect to an external URL and change the Referer in the Request Headers using Flask and Python)

I am trying to redirect a user to an external URL and also add a Referer domain in the Request Headers .

(我正在尝试将用户重定向到外部URL,并在“ Request Headers添加Referer域。)

Let's say I want the referer to be https://www.ExampleDomain.com/

(假设我希望推荐人为https://www.ExampleDomain.com/)

I have written the code below but I can't figure out how to add a referer .

(我已经在下面编写了代码,但是我不知道如何添加referer 。)

from flask import Flask, redirect

app = Flask(__name__)

@app.route('/')
def example():
    return redirect("https://youtube.com")


if __name__ == "__main__":
    app.run(debug=True)
  ask by Anatol translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...