当前位置:网站首页>实例搭建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
边栏推荐
- Shell script summary
- Practical application cases of digital Twins - smart energy
- Mathematical modeling -- analytic hierarchy process model
- Target detection, industrial defects, image segmentation -- deep learning data set induction
- 【C】 Array
- How to judge stun protocol
- 3D advanced renderer: artlandis studio 2021.2 Chinese version
- HDU multi School Game 2 1011 DOS card
- Calculation of array serial number of force deduction questions (daily question 7/28)
- 后缀自动机(sam)板子 from jly
猜你喜欢

makefile详解

MySQL流程控制之while、repeat、loop循环实例分析

A case of gradually analyzing the splitting of classes -- colorful ball collisions

Self study notes on Apache file management -- mapping folders and configuring Apache virtual machines based on single IP and multi domain names

Flask creation process day05-06 creation project

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

(codeforce547)C-Mike and Foam(质因子+容斥原理)

数字孪生实际应用案例-智慧能源篇

Does domestic ERP have a chance to beat sap?

How does DataGrid export and recover the entire database data, using a single SQL file
随机推荐
Easy to use remote sensing data set download website~~~
three. JS Part 54 how to pass structure array to shader
Three military product baselines (functional baseline, distribution baseline, product baseline) and the documents contained in the baseline
3D advanced renderer: artlandis studio 2021.2 Chinese version
RTP 发送 和接收 h265
今晚7:30 | 连界、将门、百度、碧桂园创投四位大佬眼中的AI世界,是继续高深还是回归商业本质?...
Suffix automata (SAM) board from Jly
C obtains JSON format data asynchronously from the web address
Summary of basic knowledge points of C language
Score addition and subtraction of force deduction and brushing questions (one question per day 7/27)
CUDA GDB prompt: /tmp/tmpxft**** cudafe1.stub. c: No such file or directory.
军品技术文件划分及说明
HDU multi School Game 2 1011 DOS card
Kubernetes-1.24.x feature
xxxxx
暴力递归到动态规划 01 (机器人移动)
Use of leak scanning (vulnerability scanning) tool burpsuite or burp Suite (with installation and installation package download of burpsuite+1.7.26)
How to deploy sentinel cluster of redis
年内首个“三连跌” 95号汽油回归“8元时代“
makefile详解