关于fastapi使用注意点

路由:注意点

get请求的话直接在函数里面体现就行

比如:路径如下:

http://www.jkjk.com?sourceid=7

python 复制代码
@router.get("/getsource")
async def getsourceit(sourceid:int)
	pass

post通常会是放在请求体里面,这时候将请求数据封装:

比如,post请求,请求参数wangpanid,post携带的数据通常放置在请求体中

python 复制代码
from pydantic import BaseModel
class WangpanRequest(BaseModel):
    wangpanid: int
相关推荐
一枕槐安4873 天前
Qwen 通义千问本地部署与推理服务封装
fastapi·qwen·vllm·流式推理·openai兼容api·awq量化
在努力的前端小白3 天前
基于FastAPI+LangChain+LangGraph+Agent+多模态的AI Agent 有渔渔具网站
人工智能·langchain·vue·fastapi
sun_weitao3 天前
用 FastAPI + MQTT 做一个 ESP32最小化跑通示例
中间件·vue·fastapi
峯5804 天前
一文学习FastAPI
学习·fastapi
TheBestRucy5 天前
从零构建企业级“中文法律智能问答系统”:FastAPI+Milvus+混合检索+真流式RAG实战
fastapi·milvus
卡提西亚6 天前
FastAPI基础入门
python·fastapi
Paper-Tiger6 天前
手搓 FastAPI + Redis + 流式 RAG 实录
fastapi
像风一样自由20206 天前
2.如何用FastAPI把一个Python算法封装成HTTP服务
python·算法·fastapi
狗凯之家源码网7 天前
iOS C2 V2 与 Python FastAPI 全链路远控系统深度评测
python·ios·fastapi
触底反弹7 天前
🚀 FastAPI 五大重难点深度剖析:从 500 报错到彻底搞懂 Depends、Pydantic 与 SQLAlchemy
python·fastapi