当前位置:网站首页>实例搭建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
边栏推荐
- LeetCode 1331 数组序号转换[Map] HERODING的LeetCode之路
- 美联储再加息,75基点 鲍威尔“放鸽”,美股狂欢
- 深入C语言(1)——操作符与表达式
- Reproduce 20 character short domain name bypass and XSS related knowledge points
- How to judge stun protocol
- How close can QA be to business code QA conducts testability transformation on business code
- Learn more than 4000 words, understand the problem of this pointing in JS, and handwrite to realize call, apply and bind
- 军品技术文件划分及说明
- 后缀自动机(sam)板子 from jly
- 如何判定是stun协议
猜你喜欢

Reproduce 20 character short domain name bypass and XSS related knowledge points

Asynchronous callback future mode of concurrent mode

Ten thousand words detailed Google play online application standard package format AAB

CUDA GDB prompt: /tmp/tmpxft**** cudafe1.stub. c: No such file or directory.

mysql的timestamp存在的时区问题怎么解决
![Leetcode 1331 array sequence number conversion [map] the leetcode path of heroding](/img/be/d429d0c437dc5ed7cb4448e223a83a.png)
Leetcode 1331 array sequence number conversion [map] the leetcode path of heroding

Multi level wavelet CNN for image restoration

STC单片机驱动1.8‘TFT SPI屏幕演示示例(含资料包)

通过递归实现多级联动

KNN method predicts pregnancy, KNN principle simple code
随机推荐
今晚7:30 | 连界、将门、百度、碧桂园创投四位大佬眼中的AI世界,是继续高深还是回归商业本质?...
RTP 发送 和接收 h265
3D advanced renderer: artlandis studio 2021.2 Chinese version
Matlab learning -- structured programs and user-defined functions
再学EXKMP(EXKMP模板)
[technology 1]
Bingbing learning notes: operator overloading -- implementation of date class
Division and description of military technical documents
数字孪生实际应用案例-智慧能源篇
Practical guidance for interface automation testing (Part I): what preparations should be made for interface automation
How to deploy sentinel cluster of redis
Web uploader cannot upload multiple files
正则表达绕过waf
Rongyun real-time community solution
Redis之sentinel哨兵集群怎么部署
July 28, 2022 Gu Yujia's study notes
AI_ Drug: VAE of molecular generation model (I)
During the year, the first "three consecutive falls" of No. 95 gasoline returned to the "8 Yuan era"“
How close can QA be to business code Direct exposure of defects through codediff
【科技1】