当前位置:网站首页>实例搭建Flask服务(简易版)
实例搭建Flask服务(简易版)
2022-07-29 03:29:00 【哆啦A梦的口袋呀】
python文件中写入如下代码:(get_data_flask_server.py)
import sys
from flask.globals import request
from flask import Flask
app_flask = Flask(__name__)
@app_flask.route('/get_data', methods=['GET'])
def get_data():
# 获取请求参数
tid = request.args.get("tid")
token = request.args.get("token")
data = {
}
# 编写data获取逻辑,示例如下:
data = {
"tid": tid,"token": token}
return data
if __name__ == '__main__':
# 启动服务,端口号自行修改,同局域网下设备也可访问
app_flask.run(host='0.0.0.0', port=20887)
启动服务:python get_data_flask_server.py
若启动服务的机器ip是1.2.3.4,则浏览器访问如下链接获取数据即可:http://1.2.3.4:20887/get_data?tid=12345&token=abcdefg123456789
边栏推荐
- Division and description of military technical documents
- Singleton mode (hungry and lazy)
- July 28, 2022 Gu Yujia's study notes
- Simple understanding of Poe and UPS Technology
- Various minor problems of jupyter notebook, configuration environment, code completion, remote connection, etc
- Complexity analysis learning
- MYCAT read / write separation configuration
- How close can QA be to business code QA conducts testability transformation on business code
- Multiline text omission
- 2 neural network toolbox NN
猜你喜欢

How to solve the time zone problem in MySQL timestamp

逐步分析类的拆分之案例——五彩斑斓的小球碰撞

Asynchronous callback future mode of concurrent mode

Rdkit: introduce smiles code, smart code and Morgan fingerprint (ECFP)

Matlab learning -- structured programs and user-defined functions

Summarize the knowledge points of the ten JVM modules. If you don't believe it, you still don't understand it

暴力递归到动态规划 01 (机器人移动)

During the year, the first "three consecutive falls" of No. 95 gasoline returned to the "8 Yuan era"“

for_ Example of each usage

CUDA GDB prompt: /tmp/tmpxft**** cudafe1.stub. c: No such file or directory.
随机推荐
for_ Example of each usage
Target detection, industrial defects, image segmentation -- deep learning data set induction
腾讯云使用pem登录
A simple and general method to obtain the size of function stack space
Self study notes on Apache file management -- mapping folders and configuring Apache virtual machines based on single IP and multi domain names
简历竟然敢写精通并发编程,那你说说AQS为什么要用双向链表?
Introduction and advanced level of MySQL (11)
mysql的timestamp存在的时区问题怎么解决
Realize multi-level linkage through recursion
Singleton and invariant modes of concurrent mode
Introduction and advanced level of MySQL (12)
RTP 发送 和接收 h265
Use of leak scanning (vulnerability scanning) tool burpsuite or burp Suite (with installation and installation package download of burpsuite+1.7.26)
Notes on letter symbol marking of papers
Naive Bayes -- continuous data
C obtains JSON format data asynchronously from the web address
Various minor problems of jupyter notebook, configuration environment, code completion, remote connection, etc
How close can QA be to business code QA conducts testability transformation on business code
AI_ Drug: VAE of molecular generation model (I)
1.4 nn. Module neural network (II)