【求助】2025-1-17 课程 有关FastApi的问题 #480
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HswOAuth/llm_course#480
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
我通过pycharm用fastApi写了一个接口,然后项目已经起来了:


但是为什么访问不了呢?postman调不通。
然后访问官方的那个docs接口网站也打不开,这是为什么呢?
还有一个问题,我的参数是放在requestBody里面了,但是通过接口文档127.0.0.1/docs怎么测试呢?打开以后没有地方填写参数。
问题3:我通过pycharm上的启动按钮,有时候会启动失败,但是通过命令uvicorn app:app --reload --port 9200
就没事,这是怎么回事呢?由于刚开始用pycharm,还不太熟练,不知道这是怎么回事呢?
我是cat 请上传一份完整代码 我这边帮您调一下
好嘞,十分感谢,由于我现在也是在摸索嘛,代码比较简单,就写了一个接口如下:
@app.post('/extract/transfer/info')
async def recognition_text(request: Request):
# 获取请求体中的JSON数据
data = await request.json()
secret_info = data.get('secret')
if secret_info is None: return "缺少secret参数"
return {'success': True, 'msg': '接受成功'}
通过postman是能测试的,这个如何添加参数了解

但是通过本地的那个fastApi的那个文档,如何测试这个接口(主要是不知道如何添加参数)

还望指点一下。
要点一下Ececute的吧