Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 58 of 58 for Optional (0.19 sec)

  1. tests/test_custom_middleware_exception.py

    from typing import Optional
    
    from fastapi import APIRouter, FastAPI, File, UploadFile
    from fastapi.exceptions import HTTPException
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    router = APIRouter()
    
    
    class ContentSizeLimitMiddleware:
        """Content size limiting middleware for ASGI applications
        Args:
          app (ASGI application): ASGI application
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Aug 25 21:44:40 GMT 2022
    - 2.8K bytes
    - Viewed (0)
  2. docs_src/separate_openapi_schemas/tutorial001_py39.py

    from typing import Optional
    
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    
    class Item(BaseModel):
        name: str
        description: Optional[str] = None
    
    
    app = FastAPI()
    
    
    @app.post("/items/")
    def create_item(item: Item):
        return item
    
    
    @app.get("/items/")
    def read_items() -> list[Item]:
        return [
            Item(
                name="Portal Gun",
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Aug 25 19:10:22 GMT 2023
    - 483 bytes
    - Viewed (0)
  3. tests/test_filter_pydantic_sub_model/app_pv1.py

    from typing import Optional
    
    from fastapi import Depends, FastAPI
    from pydantic import BaseModel, validator
    
    app = FastAPI()
    
    
    class ModelB(BaseModel):
        username: str
    
    
    class ModelC(ModelB):
        password: str
    
    
    class ModelA(BaseModel):
        name: str
        description: Optional[str] = None
        model_b: ModelB
    
        @validator("name")
        def lower_username(cls, name: str, values):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 784 bytes
    - Viewed (0)
  4. tests/test_param_include_in_schema.py

    from typing import Optional
    
    import pytest
    from fastapi import Cookie, FastAPI, Header, Path, Query
    from fastapi.testclient import TestClient
    
    app = FastAPI()
    
    
    @app.get("/hidden_cookie")
    async def hidden_cookie(
        hidden_cookie: Optional[str] = Cookie(default=None, include_in_schema=False),
    ):
        return {"hidden_cookie": hidden_cookie}
    
    
    @app.get("/hidden_header")
    async def hidden_header(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 7.4K bytes
    - Viewed (0)
  5. fastapi/encoders.py

                """
            ),
        ],
        include: Annotated[
            Optional[IncEx],
            Doc(
                """
                Pydantic's `include` parameter, passed to Pydantic models to set the
                fields to include.
                """
            ),
        ] = None,
        exclude: Annotated[
            Optional[IncEx],
            Doc(
                """
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 21:56:59 GMT 2024
    - 10.8K bytes
    - Viewed (0)
  6. tests/test_extra_routes.py

    from typing import Optional
    
    from dirty_equals import IsDict
    from fastapi import FastAPI
    from fastapi.responses import JSONResponse
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
    
    
    @app.api_route("/items/{item_id}", methods=["GET"])
    def get_items(item_id: str):
        return {"item_id": item_id}
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  7. fastapi/exceptions.py

    from typing import Any, Dict, Optional, Sequence, Type, Union
    
    from pydantic import BaseModel, create_model
    from starlette.exceptions import HTTPException as StarletteHTTPException
    from starlette.exceptions import WebSocketException as StarletteWebSocketException
    from typing_extensions import Annotated, Doc
    
    
    class HTTPException(StarletteHTTPException):
        """
        An HTTP exception you can raise in your own code to show errors to the client.
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:48:51 GMT 2024
    - 4.9K bytes
    - Viewed (0)
  8. configure.py

          Nvidia GPUs".
        enabled_by_default: boolean for default behavior.
        question: optional string for how to ask for user input.
        yes_reply: optional string for reply when feature is enabled.
        no_reply: optional string for reply when feature is disabled.
    
      Returns:
        boolean value of the variable.
    
      Raises:
    Python
    - Registered: Tue Apr 30 12:39:09 GMT 2024
    - Last Modified: Mon Apr 15 18:25:36 GMT 2024
    - 53.8K bytes
    - Viewed (1)
Back to top