ue http 请求学习笔记

目录

插件名:

http_server.py

ue中设置请求例子:


插件名:

DTHttpRequest.zip

http_server.py

python 复制代码
from flask import Flask, request, jsonify
from datetime import datetime

app = Flask(__name__)

@app.before_request
def log_request():
    print(
        f"[{datetime.now()}] "
        f"{request.remote_addr} "
        f"{request.method} "
        f"{request.path}"
    )
    if request.data:
        print("Body:", request.data.decode("utf-8"))

@app.route("/", methods=["GET"])
def hello():
    return jsonify(status="ok", msg="hello world")

@app.route("/echo", methods=["POST"])
def echo():
    data = request.get_json(silent=True)
    return jsonify(status="ok", received=data)

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=7999)

ue中设置请求例子:

相关推荐
ACP广源盛1392462567313 分钟前
IX8024与科学大模型的碰撞@ACP#筑牢科研 AI 算力高速枢纽分享
运维·服务器·网络·数据库·人工智能·嵌入式硬件·电脑
Empty-Filled1 小时前
AI生成测试用例功能怎么测:一个完整实战案例
网络·人工智能·测试用例
码云数智-大飞2 小时前
本地部署大模型:隐私安全与多元优势一站式解读
运维·网络·人工智能
jinanwuhuaguo2 小时前
(第二十九篇)OpenClaw 实时与具身的跃迁——从异步孤岛到数字世界的“原住民”
前端·网络·人工智能·重构·openclaw
汤愈韬2 小时前
三种常用 NAT 的经典案例
网络协议·网络安全·security
等风来不如迎风去2 小时前
【win11】最佳性能:fix 没有壁纸,一直黑屏
网络·人工智能
Harvy_没救了3 小时前
【网络部署】 Win11 + VMware CentOS8 + Nginx 文件共享服务 Wiki
运维·网络·nginx
汤愈韬3 小时前
NAT Server 与目的Nat
网络·网络协议·网络安全·security
2401_873479404 小时前
断网时如何实时判断IP归属?嵌入本地离线库,保障风控不中断
运维·服务器·网络
7ACE5 小时前
Wireshark TS | TLP 超时时间
网络·网络协议·tcp/ip·wireshark·tcpdump