- Sort Score
- Result 10 results
- Languages All
Results 171 - 180 of 1,976 for Fastapi (0.14 sec)
-
tests/test_custom_route_class.py
import pytest from fastapi import APIRouter, FastAPI from fastapi.routing import APIRoute from fastapi.testclient import TestClient from starlette.routing import Route app = FastAPI() class APIRouteA(APIRoute): x_type = "A" class APIRouteB(APIRoute): x_type = "B" class APIRouteC(APIRoute): x_type = "C" router_a = APIRouter(route_class=APIRouteA) router_b = APIRouter(route_class=APIRouteB)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.1K bytes - Viewed (0) -
docs/es/docs/python-types.md
/// **FastAPI** está todo basado en Pydantic. Vas a ver mucho más de esto en práctica en el [Tutorial - User Guide](tutorial/index.md){.internal-link target=_blank}. ## Type hints en **FastAPI** **FastAPI** aprovecha estos type hints para hacer varias cosas. Con **FastAPI** declaras los parámetros con type hints y obtienes: * **Soporte en el editor**.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 9.1K bytes - Viewed (0) -
docs_src/app_testing/tutorial003.py
from fastapi import FastAPI from fastapi.testclient import TestClient app = FastAPI() items = {} @app.on_event("startup") async def startup_event(): items["foo"] = {"name": "Fighters"} items["bar"] = {"name": "Tenders"} @app.get("/items/{item_id}") async def read_items(item_id: str): return items[item_id] def test_read_items(): with TestClient(app) as client:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 528 bytes - Viewed (0) -
tests/test_router_prefix_with_template.py
from fastapi import APIRouter, FastAPI from fastapi.testclient import TestClient app = FastAPI() router = APIRouter() @router.get("/users/{id}") def read_user(segment: str, id: str): return {"segment": segment, "id": id} app.include_router(router, prefix="/{segment}") client = TestClient(app) def test_get(): response = client.get("/seg/users/foo")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Apr 08 04:37:38 UTC 2020 - 484 bytes - Viewed (0) -
tests/test_response_code_no_body.py
import typing from fastapi import FastAPI from fastapi.responses import JSONResponse from fastapi.testclient import TestClient from pydantic import BaseModel app = FastAPI() class JsonApiResponse(JSONResponse): media_type = "application/vnd.api+json" class Error(BaseModel): status: str title: str class JsonApiError(BaseModel): errors: typing.List[Error] @app.get( "/a",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.2K bytes - Viewed (0) -
docs/pt/docs/tutorial/body-multiple-params.md
Por exemplo, extendendo o modelo anterior, você poder decidir por ter uma outra chave `importance` no mesmo corpo, além de `item` e `user`. Se você declará-lo como é, porque é um valor singular, o **FastAPI** assumirá que se trata de um parâmetro de consulta. Mas você pode instruir o **FastAPI** para tratá-lo como outra chave do corpo usando `Body`:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 6K bytes - Viewed (0) -
docs_src/response_model/tutorial003_04_py310.py
from fastapi import FastAPI, Response from fastapi.responses import RedirectResponse app = FastAPI() @app.get("/portal") async def get_portal(teleport: bool = False) -> Response | dict: if teleport: return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Jan 10 16:22:47 UTC 2023 - 352 bytes - Viewed (0) -
docs_src/custom_response/tutorial003.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 394 bytes - Viewed (0) -
docs_src/response_model/tutorial003_02.py
from fastapi import FastAPI, Response from fastapi.responses import JSONResponse, RedirectResponse app = FastAPI() @app.get("/portal") async def get_portal(teleport: bool = False) -> Response: if teleport: return RedirectResponse(url="https://www.youtube.com/watch?v=dQw4w9WgXcQ")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Jan 10 16:22:47 UTC 2023 - 381 bytes - Viewed (0) -
docs_src/cors/tutorial001.py
from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware app = FastAPI() origins = [ "http://localhost.tiangolo.com", "https://localhost.tiangolo.com", "http://localhost", "http://localhost:8080", ] app.add_middleware( CORSMiddleware, allow_origins=origins, allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) @app.get("/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 459 bytes - Viewed (0)