Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 41 for read_root (0.18 sec)

  1. tests/test_response_model_invalid.py

            app = FastAPI()
    
            @app.get("/", response_model=NonPydanticModel)
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=List[NonPydanticModel])
            def read_root():
                pass  # pragma: nocover
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Feb 29 13:04:35 GMT 2020
    - 1.1K bytes
    - Viewed (0)
  2. tests/test_computed_fields.py

            width: int
            length: int
    
            @computed_field
            @property
            def area(self) -> int:
                return self.width * self.length
    
        @app.get("/")
        def read_root() -> Rectangle:
            return Rectangle(width=3, length=4)
    
        client = TestClient(app)
        return client
    
    
    @needs_pydanticv2
    def test_get(client: TestClient):
        response = client.get("/")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Aug 04 20:47:07 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  3. docs_src/using_request_directly/tutorial001.py

    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    def read_root(item_id: str, request: Request):
        client_host = request.client.host
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 230 bytes
    - Viewed (0)
  4. docs/de/docs/index.md

    ### Erstellung
    
    * Erstellen Sie eine Datei `main.py` mit:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    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">
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 30 20:28:17 GMT 2024
    - 21.2K bytes
    - Viewed (0)
  5. docs/he/docs/index.md

    </div>
    
    ## דוגמא
    
    ### צרו אותה
    
    -   צרו קובץ בשם `main.py` עם:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    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">
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 21.2K bytes
    - Viewed (0)
  6. docs/en/docs/index.md

    ## Example
    
    ### Create it
    
    * Create a file `main.py` with:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    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">
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  7. docs/zh/docs/deployment/deta.md

    ## 基础 **FastAPI** 应用
    
    * 创建应用文件夹,例如 `./fastapideta/`,进入文件夹
    
    ### FastAPI 代码
    
    * 创建包含如下代码的 `main.py`:
    
    ```Python
    from fastapi import FastAPI
    
    app = FastAPI()
    
    
    @app.get("/")
    def read_root():
        return {"Hello": "World"}
    
    
    @app.get("/items/{item_id}")
    def read_item(item_id: int):
        return {"item_id": item_id}
    ```
    
    ### 需求项
    
    在文件夹里新建包含如下内容的 `requirements.txt` 文件:
    
    ```text
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sun Jan 28 18:06:55 GMT 2024
    - 5.1K bytes
    - Viewed (0)
  8. docs/ko/docs/index.md

    </div>
    
    ## 예제
    
    ### 만들기
    
    * `main.py` 파일을 만드십시오:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    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">
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 19.5K bytes
    - Viewed (0)
  9. docs/zh-hant/docs/index.md

    </div>
    
    ## 範例
    
    ### 建立
    
    - 建立一個 python 檔案 `main.py`,並寫入以下程式碼:
    
    ```Python
    from typing import Union
    
    from fastapi import FastAPI
    
    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">
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 23:58:47 GMT 2024
    - 18.8K bytes
    - Viewed (0)
  10. .github/DISCUSSION_TEMPLATE/questions.yml

          placeholder: |
            from fastapi import FastAPI
    
            app = FastAPI()
    
    
            @app.get("/")
            def read_root():
                return {"Hello": "World"}
          render: python
        validations:
          required: true
      - type: textarea
        id: description
        attributes:
          label: Description
          description: |
    Others
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Aug 03 15:59:41 GMT 2023
    - 5.8K bytes
    - Viewed (1)
Back to top