Skip to content

Commit f7076a4

Browse files
committed
add flask-24-http-proxy
1 parent 7e34e53 commit f7076a4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

Flask-24-转发请求/app.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from flask import Flask
2+
import requests
3+
4+
app = Flask(__name__)
5+
6+
7+
@app.route('/')
8+
def index():
9+
req = requests.get('http://127.0.0.1:5000/proxy')
10+
return req.text
11+
12+
13+
@app.route('/proxy')
14+
def proxy():
15+
return "Hello Flask."
16+
17+
18+
if __name__ == '__main__':
19+
app.run('0.0.0.0', debug=True)

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
20. [flask-apscheduler](https://xugaoxiang.com/2020/10/08/flask-20-apscheduler/)
2323
21. [添加favicon](https://xugaoxiang.com/2020/11/11/flask-21-favicon/)
2424
22. [在浏览器中播放rtsp实时流](https://xugaoxiang.com/2020/11/12/flask-22-opencv-rtsp/)
25-
23. [简单异步任务](https://xugaoxiang.com/2020/11/16/flask-23-threadpoolexecutor/)
25+
23. [简单异步任务](https://xugaoxiang.com/2020/11/16/flask-23-threadpoolexecutor/)
26+
24. [http请求转发](https://xugaoxiang.com/2020/11/24/flask-24-http-proxy/)

0 commit comments

Comments
 (0)