- Sort Score
- Result 10 results
- Languages All
Results 1311 - 1320 of 1,977 for Fastapi (0.06 sec)
-
docs_src/request_files/tutorial001_02_an.py
from typing import Union from fastapi import FastAPI, File, UploadFile from typing_extensions import Annotated app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[Union[bytes, None], File()] = None): if not file: return {"message": "No file sent"} else: return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: Union[UploadFile, None] = None):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 553 bytes - Viewed (0) -
docs_src/request_files/tutorial001_02_an_py39.py
from typing import Annotated, Union from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[Union[bytes, None], File()] = None): if not file: return {"message": "No file sent"} else: return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: Union[UploadFile, None] = None): if not file:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 524 bytes - Viewed (0) -
docs_src/schema_extra_example/tutorial002.py
from typing import Union from fastapi import FastAPI from pydantic import BaseModel, Field app = FastAPI() class Item(BaseModel): name: str = Field(examples=["Foo"]) description: Union[str, None] = Field(default=None, examples=["A very nice Item"]) price: float = Field(examples=[35.4]) tax: Union[float, None] = Field(default=None, examples=[3.2]) @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 517 bytes - Viewed (0) -
docs_src/body_nested_models/tutorial004.py
from typing import Set, Union from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Image(BaseModel): url: str name: str class Item(BaseModel): name: str description: Union[str, None] = None price: float tax: Union[float, None] = None tags: Set[str] = set() image: Union[Image, None] = None @app.put("/items/{item_id}")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat May 14 11:59:59 UTC 2022 - 504 bytes - Viewed (0) -
docs_src/dataclasses/tutorial002.py
from dataclasses import dataclass, field from typing import List, Union from fastapi import FastAPI @dataclass class Item: name: str price: float tags: List[str] = field(default_factory=list) description: Union[str, None] = None tax: Union[float, None] = None app = FastAPI() @app.get("/items/next", response_model=Item) async def read_next_item(): return {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Jul 31 14:09:15 UTC 2024 - 549 bytes - Viewed (0) -
docs_src/path_operation_configuration/tutorial002_py310.py
from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Item(BaseModel): name: str description: str | None = None price: float tax: float | None = None tags: set[str] = set() @app.post("/items/", response_model=Item, tags=["items"]) async def create_item(item: Item): return item @app.get("/items/", tags=["items"]) async def read_items():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jan 07 14:11:31 UTC 2022 - 537 bytes - Viewed (0) -
fastapi/security/open_id_connect_url.py
from typing import Optional from fastapi.openapi.models import OpenIdConnect as OpenIdConnectModel from fastapi.security.base import SecurityBase from starlette.exceptions import HTTPException from starlette.requests import Request from starlette.status import HTTP_403_FORBIDDEN from typing_extensions import Annotated, Doc class OpenIdConnect(SecurityBase): """ OpenID Connect authentication class. An instance of it would be used as a
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Apr 02 02:48:51 UTC 2024 - 2.7K bytes - Viewed (0) -
tests/test_tutorial/test_additional_responses/test_tutorial002.py
import os import shutil from dirty_equals import IsDict from fastapi.testclient import TestClient from docs_src.additional_responses.tutorial002 import app client = TestClient(app) def test_path_operation(): response = client.get("/items/foo") assert response.status_code == 200, response.text assert response.json() == {"id": "foo", "value": "there goes my hero"} def test_path_operation_img():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.6K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial001_py310.py
import pytest from fastapi.testclient import TestClient from ...utils import needs_py310, needs_pydanticv2 @pytest.fixture(name="client") def get_client() -> TestClient: from docs_src.separate_openapi_schemas.tutorial001_py310 import app client = TestClient(app) return client @needs_py310 def test_create_item(client: TestClient) -> None: response = client.post("/items/", json={"name": "Foo"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Sep 28 04:14:40 UTC 2023 - 4.9K bytes - Viewed (0) -
tests/test_tutorial/test_separate_openapi_schemas/test_tutorial002.py
import pytest from fastapi.testclient import TestClient from ...utils import needs_pydanticv2 @pytest.fixture(name="client") def get_client() -> TestClient: from docs_src.separate_openapi_schemas.tutorial002 import app client = TestClient(app) return client def test_create_item(client: TestClient) -> None: response = client.post("/items/", json={"name": "Foo"}) assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 25 19:10:22 UTC 2023 - 4.8K bytes - Viewed (0)