pip3 install fastapi uvicorn -i https://mirrors.aliyun.com/pypi/simple
pip3 install fastapi -i https://mirrors.aliyun.com/pypi/simple
uvicorn selectanswer:app --reload
配置截图如下:
运行截图如下:
import requests from fastapi import FastAPI from pydantic import BaseModel from bs4 import BeautifulSoupapp = FastAPI()sAnswerApi="http://test.vcing.top:81/api.php?key=chaoxing&q=" @app.get("/answer/") async def read_item(ask: str): response = requests.request("get", sAnswerApi ask) response = BeautifulSoup(response.text,"html.parser") return {"response":response.text}
暂无评论