Search Options

Results per page
Sort
Preferred Languages
Advance

Results 451 - 460 of 805 for fdef (0.01 sec)

  1. tests/test_openapi_schema_type.py

        [
            "array",
            ["string", "null"],
            None,
        ],
    )
    def test_allowed_schema_type(
        type_value: Optional[Union[SchemaType, list[SchemaType]]],
    ) -> None:
        """Test that Schema accepts SchemaType, List[SchemaType] and None for type field."""
        schema = Schema(type=type_value)
        assert schema.type == type_value
    
    
    def test_invalid_type_value() -> None:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 730 bytes
    - Viewed (0)
  2. docs_src/app_testing/app_a_py39/test_main.py

    from fastapi.testclient import TestClient
    
    from .main import app
    
    client = TestClient(app)
    
    
    def test_read_main():
        response = client.get("/")
        assert response.status_code == 200
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 238 bytes
    - Viewed (0)
  3. docs_src/cookie_params/tutorial001_py39.py

    from typing import Union
    
    from fastapi import Cookie, FastAPI
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(ads_id: Union[str, None] = Cookie(default=None)):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 202 bytes
    - Viewed (0)
  4. docs_src/dependencies/tutorial008d_an_py39.py

    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("We don't swallow the internal error here, we raise again 😎")
            raise
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Feb 24 23:06:37 UTC 2024
    - 734 bytes
    - Viewed (0)
  5. tests/test_depends_hashable.py

    # as other tools that use them depend on that
    # Ref: https://github.com/fastapi/fastapi/pull/14320
    
    from fastapi import Depends, Security
    
    
    def dep():
        pass
    
    
    def test_depends_hashable():
        dep()  # just for coverage
        d1 = Depends(dep)
        d2 = Depends(dep)
        d3 = Depends(dep, scope="function")
        d4 = Depends(dep, scope="function")
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Nov 19 16:50:18 UTC 2025
    - 596 bytes
    - Viewed (0)
  6. docs_src/header_params/tutorial001_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Header
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(user_agent: Union[str, None] = Header(default=None)):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 214 bytes
    - Viewed (0)
  7. docs_src/request_forms/tutorial001_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Form
    
    app = FastAPI()
    
    
    @app.post("/login/")
    async def login(username: Annotated[str, Form()], password: Annotated[str, Form()]):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 223 bytes
    - Viewed (0)
  8. docs/ru/docs/index.md

    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int, q: Union[str, None] = None):
        return {"item_id": item_id, "q": q}
    ```
    
    <details markdown="1">
    <summary>Или ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ <code>async def</code>...</summary>
    
    Если ваш ΠΊΠΎΠ΄ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ `async` / `await`, ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ `async def`:
    
    ```Python hl_lines="9  14"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Thu Dec 11 21:25:03 UTC 2025
    - 32K bytes
    - Viewed (0)
  9. docs/ru/docs/advanced/events.md

    Π’Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΠΎΠΏΡ€Π΅Π΄Π΅Π»ΠΈΡ‚ΡŒ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠΈ событий (Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ), ΠΊΠΎΡ‚ΠΎΡ€Ρ‹Π΅ Π½ΡƒΠΆΠ½ΠΎ Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚ΡŒ Π΄ΠΎ старта прилоТСния ΠΈΠ»ΠΈ ΠΏΡ€ΠΈ Π΅Π³ΠΎ Π·Π°Π²Π΅Ρ€ΡˆΠ΅Π½ΠΈΠΈ.
    
    Π­Ρ‚ΠΈ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ ΠΌΠΎΠΆΠ½ΠΎ ΠΎΠ±ΡŠΡΠ²ΠΈΡ‚ΡŒ с `async def` ΠΈΠ»ΠΈ ΠΎΠ±Ρ‹Ρ‡Π½Ρ‹ΠΌ `def`.
    
    ### Π‘ΠΎΠ±Ρ‹Ρ‚ΠΈΠ΅ `startup` { #startup-event }
    
    Π§Ρ‚ΠΎΠ±Ρ‹ Π΄ΠΎΠ±Π°Π²ΠΈΡ‚ΡŒ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΡŽ, ΠΊΠΎΡ‚ΠΎΡ€ΡƒΡŽ Π½ΡƒΠΆΠ½ΠΎ Π·Π°ΠΏΡƒΡΡ‚ΠΈΡ‚ΡŒ Π΄ΠΎ старта прилоТСния, ΠΎΠ±ΡŠΡΠ²ΠΈΡ‚Π΅ Π΅Ρ‘ ΠΊΠ°ΠΊ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊ события `"startup"`:
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 12.7K bytes
    - Viewed (0)
  10. docs_src/security/tutorial007_an_py39.py

    import secrets
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, status
    from fastapi.security import HTTPBasic, HTTPBasicCredentials
    
    app = FastAPI()
    
    security = HTTPBasic()
    
    
    def get_current_username(
        credentials: Annotated[HTTPBasicCredentials, Depends(security)],
    ):
        current_username_bytes = credentials.username.encode("utf8")
        correct_username_bytes = b"stanleyjobson"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 1.1K bytes
    - Viewed (0)
Back to top