File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 23
23
- [ CH5 Python[ 4]] ( https://hackmd.io/@macs1207/HJF56PlnS#/ )
24
24
1 . [ DOM解析] ( https://hackmd.io/@macs1207/HJF56PlnS#/2 )
25
25
2 . [ API] ( https://hackmd.io/@macs1207/HJF56PlnS#/3 )
26
+ - [ CH6 Python[ 5]] ( https://hackmd.io/@macs1207/BkU_hwqnS# )
27
+ 1 . [ Flask] ( https://hackmd.io/@macs1207/BkU_hwqnS#/2 )
26
28
27
29
28
30
# 作者
Original file line number Diff line number Diff line change
1
+ from flask import Flask , request
2
+
3
+ app = Flask (__name__ )
4
+
5
+ @app .route ('/' , methods = ["GET" , "POST" ])
6
+ def index ():
7
+ if request .method == "GET" :
8
+ data = request .args .get ("data" )
9
+ return "GET, {}" .format (data )
10
+ elif request .method == "POST" :
11
+ data = request .values ['data' ]
12
+ return "POST, {}" .format (data )
13
+
14
+ if __name__ == '__main__' :
15
+ app .run (port = 8080 )
Original file line number Diff line number Diff line change
1
+ import requests
2
+
3
+ rs = requests .post ("http://127.0.0.1:8080/" , data = {"name" : "IAMPOST" })
4
+ print (rs .text )
You can’t perform that action at this time.
0 commit comments