Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for read_root (0.2 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 May 05 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 May 05 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 May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 230 bytes
    - Viewed (0)
  4. 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)
  5. .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 May 05 07:19:11 GMT 2024
    - Last Modified: Thu Aug 03 15:59:41 GMT 2023
    - 5.8K bytes
    - Viewed (1)
  6. docs/fr/docs/deployment/docker.md

    * Créer un répertoire `app` et y entrer.
    * Créez un fichier `main.py` avec :
    
    ```Python
    from typing import Optional
    
    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: Optional[str] = None):
        return {"item_id": item_id, "q": q}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 7.5K bytes
    - Viewed (0)
  7. cni/pkg/nodeagent/ztunnelserver_test.go

    		ztunServer *ztunnelServer
    	}{ztunClient: ztunClient, ztunServer: ztun}
    }
    
    func readRequest(t *testing.T, c *net.UnixConn) (*zdsapi.WorkloadRequest, []int) {
    	var oob [1024]byte
    	m, oobn, err := readProto[zdsapi.WorkloadRequest](c, time.Second, oob[:])
    	if err != nil {
    		panic(err)
    	}
    
    	receivedoob := oob[:oobn]
    	msgs, err := unix.ParseSocketControlMessage(receivedoob)
    	if err != nil {
    		panic(err)
    	}
    Go
    - Registered: Wed May 08 22:53:08 GMT 2024
    - Last Modified: Fri Apr 12 21:47:31 GMT 2024
    - 8.6K bytes
    - Viewed (0)
Back to top