簡體   English   中英

在接口中測試 FastAPI 端點

[英]Testing FastAPI endpoints in the interface

我可以訪問包含以下分支的私有 GitLab 項目: maindevelopnew_branch 機器學習項目非常復雜,包含 NLP 的各種轉換器,以及從輸入文本生成一些 output 的許多步驟。 也使用了 FastAPI。 我正在使用 Windows。

我按照說明運行pipenv run start

←[32mINFO←[0m:     Started server process [←[36m12988←[0m]
←[32mINFO←[0m:     Waiting for application startup.
←[32mINFO←[0m:     Application startup complete.
←[32mINFO←[0m:     Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)

I go to http://127.0.0.1:8000 and get (though the instructions say to go to http://localhost:8000/):

{"name":"my app API","version":"0.0.1","currentTime":"01/07/2022, 04:41:36"}

在終端:

←[32mINFO←[0m:     127.0.0.1:65248 - "←[1mGET / HTTP/1.1←[0m" ←[32m200 OK←[0m

但是我如何實際使用該應用程序? 我在互聯網上看到了一個簡單的示例,我在瀏覽器中導航到端點,但在我的情況下,項目要復雜得多,並且文件夾的樹很大。 我在瀏覽器中的地址之后輸入的任何內容都會給我{"detail":"Not Found"}

由於 FastAPI 只是一個用於創建 API 的框架,因此沒有可用的真實用戶界面(除了它生成的文檔)。 它不是 web 應用程序 - 只是端點定義的集合。

來自 FastAPI 文檔:

交互式 API 文檔

替代 API 文檔

如果您想知道應用程序中有哪些端點可用,請嘗試轉到http://127.0.0.1:8080/docshttp://127.0.0.1:8080/redoc

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM