Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1031 - 1040 of 1,169 for def2 (0.04 sec)

  1. docs/em/docs/tutorial/testing.md

    โœ ๐Ÿ™… `assert` ๐Ÿ“„ โฎ๏ธ ๐Ÿฉ ๐Ÿ ๐Ÿงฌ ๐Ÿ‘ˆ ๐Ÿ‘† ๐Ÿ’ช โœ… (๐Ÿ”„, ๐Ÿฉ `pytest`).
    
    ```Python hl_lines="2  12  15-18"
    {!../../docs_src/app_testing/tutorial001.py!}
    ```
    
    /// tip
    
    ๐Ÿ‘€ ๐Ÿ‘ˆ ๐Ÿ”ฌ ๐Ÿ”ข ๐Ÿ˜ `def`, ๐Ÿšซ `async def`.
    
     & ๐Ÿค™ ๐Ÿ‘ฉโ€๐Ÿ’ป ๐Ÿ˜ ๐Ÿค™, ๐Ÿšซ โš™๏ธ `await`.
    
    ๐Ÿ‘‰ โœ” ๐Ÿ‘† โš™๏ธ `pytest` ๐Ÿ”— ๐Ÿต ๐Ÿคข.
    
    ///
    
    /// note | "๐Ÿ“ก โ„น"
    
    ๐Ÿ‘† ๐Ÿ’ช โš™๏ธ `from starlette.testclient import TestClient`.
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.1K bytes
    - Viewed (0)
  2. docs_src/body_multiple_params/tutorial004.py

        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item,
        user: User,
        importance: int = Body(gt=0),
        q: Union[str, None] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Mar 10 18:49:18 UTC 2023
    - 653 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_background_tasks/test_tutorial002_an_py310.py

    import os
    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py310
    
    
    @needs_py310
    def test():
        from docs_src.background_tasks.tutorial002_an_py310 import app
    
        client = TestClient(app)
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 631 bytes
    - Viewed (0)
  4. tests/test_tutorial/test_background_tasks/test_tutorial002_an_py39.py

    import os
    from pathlib import Path
    
    from fastapi.testclient import TestClient
    
    from ...utils import needs_py39
    
    
    @needs_py39
    def test():
        from docs_src.background_tasks.tutorial002_an_py39 import app
    
        client = TestClient(app)
        log = Path("log.txt")
        if log.is_file():
            os.remove(log)  # pragma: no cover
        response = client.post("/send-notification/******@****.***?q=some-query")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 628 bytes
    - Viewed (0)
  5. docs_src/body_multiple_params/tutorial004_an.py

        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item,
        user: User,
        importance: Annotated[int, Body(gt=0)],
        q: Union[str, None] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 703 bytes
    - Viewed (0)
  6. docs_src/body_multiple_params/tutorial004_an_py39.py

        price: float
        tax: Union[float, None] = None
    
    
    class User(BaseModel):
        username: str
        full_name: Union[str, None] = None
    
    
    @app.put("/items/{item_id}")
    async def update_item(
        *,
        item_id: int,
        item: Item,
        user: User,
        importance: Annotated[int, Body(gt=0)],
        q: Union[str, None] = None,
    ):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Mar 18 12:29:59 UTC 2023
    - 674 bytes
    - Viewed (0)
  7. docs_src/metadata/tutorial001_1.py

            "email": "******@****.***",
        },
        license_info={
            "name": "Apache 2.0",
            "identifier": "MIT",
        },
    )
    
    
    @app.get("/items/")
    async def read_items():
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 767 bytes
    - Viewed (0)
  8. docs_src/path_operation_advanced_configuration/tutorial007.py

    @app.post(
        "/items/",
        openapi_extra={
            "requestBody": {
                "content": {"application/x-yaml": {"schema": Item.model_json_schema()}},
                "required": True,
            },
        },
    )
    async def create_item(request: Request):
        raw_body = await request.body()
        try:
            data = yaml.safe_load(raw_body)
        except yaml.YAMLError:
            raise HTTPException(status_code=422, detail="Invalid YAML")
        try:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 19:40:57 UTC 2024
    - 822 bytes
    - Viewed (0)
  9. docs/em/docs/tutorial/sql-databases.md

    ```
    
    ...& โ†ฉ๏ธ ๐Ÿ‘ฅ โš™๏ธ:
    
    ```Python
    user = db.query(User).first()
    ```
    
    โคด๏ธ ๐Ÿ‘ฅ ๐Ÿ”œ ๐Ÿ“ฃ *โžก ๐Ÿ› ๏ธ ๐Ÿ”ข* & ๐Ÿ”— ๐Ÿต `async def`, โฎ๏ธ ๐Ÿ˜ `def`,:
    
    ```Python hl_lines="2"
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        ...
    ```
    
    /// info
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 25K bytes
    - Viewed (0)
  10. docs/fr/docs/tutorial/first-steps.md

    Elle sera appelรฉe par **FastAPI** quand une requรชte sur l'URL `/` sera reรงue via une opรฉration `GET`.
    
    Ici, c'est une fonction asynchrone (dรฉfinie avec `async def`).
    
    ---
    
    Vous pourriez aussi la dรฉfinir comme une fonction classique plutรดt qu'avec `async def` :
    
    ```Python hl_lines="7"
    {!../../docs_src/first_steps/tutorial003.py!}
    ```
    
    /// note
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.3K bytes
    - Viewed (0)
Back to top