Wie übergeben Sie URL als Pfadparameter an eine Fastapi -Route?

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie übergeben Sie URL als Pfadparameter an eine Fastapi -Route?

by Anonymous » 24 Feb 2025, 12:57

Ich habe eine einfache API mit Fastapi erstellt und versuche, eine URL an eine Fastapi-Route als beliebiger Pfad zu übergeben. Parameter. PrettyPrint-Override ">

Code: Select all

from fastapi import FastAPI
app = FastAPI()
@app.post("/{path}")
def pred_image(path:str):
print("path",path)
return {'path':path}
< /code>
Wenn ich es testet, funktioniert es nicht und wirft einen Fehler aus. Ich teste es so: < /p>
http://127.0.0.1:8000/https://raw.githubusercontent.com/ultralytics/yolov5/master/data/images/zidane.jpg

Top