Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 111 - 120 of 543 for item_b (0.05 seconds)

  1. docs_src/dependencies/tutorial008c_an_py39.py

    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
                f"The portal gun is too dangerous to be owned by {username}"
            )
        if item_id != "plumbus":
            raise HTTPException(
                status_code=404, detail="Item not found, there's only a plumbus here"
            )
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 700 bytes
    - Click Count (0)
  2. tests/test_tutorial/test_path_params/test_tutorial002.py

    def test_get_items():
        response = client.get("/items/1")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": 1}
    
    
    def test_get_items_invalid_id():
        response = client.get("/items/item1")
        assert response.status_code == 422, response.text
        assert response.json() == {
            "detail": [
                {
                    "input": "item1",
                    "loc": ["path", "item_id"],
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Dec 26 10:43:02 GMT 2025
    - 4.2K bytes
    - Click Count (0)
  3. src/test/java/org/codelibs/core/io/SerializeUtilTest.java

            assertEquals(arr.length, result.length);
            assertEquals(arr[0], result[0]);
    
            // Test ArrayList
            final List<String> list = new ArrayList<>();
            list.add("item1");
            list.add("item2");
            binary = SerializeUtil.fromObjectToBinary(list);
            @SuppressWarnings("unchecked")
            final List<String> resultList = (List<String>) SerializeUtil.fromBinaryToObject(binary);
    Created: Sat Dec 20 08:55:33 GMT 2025
    - Last Modified: Sat Nov 22 11:21:59 GMT 2025
    - 7.6K bytes
    - Click Count (0)
  4. tests/test_tutorial/test_handling_errors/test_tutorial006.py

            ]
        }
    
    
    def test_get_http_error():
        response = client.get("/items/3")
        assert response.status_code == 418, response.text
        assert response.json() == {"detail": "Nope! I don't like 3."}
    
    
    def test_get():
        response = client.get("/items/2")
        assert response.status_code == 200, response.text
        assert response.json() == {"item_id": 2}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Dec 27 18:19:10 GMT 2025
    - 3.6K bytes
    - Click Count (0)
  5. docs/zh/docs/index.md

    使用浏览器访问 <a href="http://127.0.0.1:8000/items/5?q=somequery" class="external-link" target="_blank">http://127.0.0.1:8000/items/5?q=somequery</a>。
    
    你将会看到如下 JSON 响应:
    
    ```JSON
    {"item_id": 5, "q": "somequery"}
    ```
    
    你已经创建了一个具有以下功能的 API:
    
    * 通过 _路径_ `/` 和 `/items/{item_id}` 接受 HTTP 请求。
    * 以上 _路径_ 都接受 `GET` 操作(也被称为 HTTP _方法_)。
    * `/items/{item_id}` _路径_ 有一个 _路径参数_ `item_id` 并且应该为 `int` 类型。
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Sat Oct 11 17:48:49 GMT 2025
    - 18.2K bytes
    - Click Count (0)
  6. docs_src/response_model/tutorial006_py310.py

        },
    }
    
    
    @app.get(
        "/items/{item_id}/name",
        response_model=Item,
        response_model_include=["name", "description"],
    )
    async def read_item_name(item_id: str):
        return items[item_id]
    
    
    @app.get("/items/{item_id}/public", response_model=Item, response_model_exclude=["tax"])
    async def read_item_public_data(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 816 bytes
    - Click Count (0)
  7. tests/test_tutorial/test_path_operation_configurations/test_tutorial006.py

    client = TestClient(app)
    
    
    @pytest.mark.parametrize(
        "path,expected_status,expected_response",
        [
            ("/items/", 200, [{"name": "Foo", "price": 42}]),
            ("/users/", 200, [{"username": "johndoe"}]),
            ("/elements/", 200, [{"item_id": "Foo"}]),
        ],
    )
    def test_query_params_str_validations(path, expected_status, expected_response):
        response = client.get(path)
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 2.4K bytes
    - Click Count (0)
  8. docs_src/response_model/tutorial004_py310.py

    }
    
    
    @app.get("/items/{item_id}", response_model=Item, response_model_exclude_unset=True)
    async def read_item(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 595 bytes
    - Click Count (0)
  9. docs_src/extra_models/tutorial003_py39.py

        size: int
    
    
    items = {
        "item1": {"description": "All my friends drive a low rider", "type": "car"},
        "item2": {
            "description": "Music is my aeroplane, it's my aeroplane",
            "type": "plane",
            "size": 5,
        },
    }
    
    
    @app.get("/items/{item_id}", response_model=Union[PlaneItem, CarItem])
    async def read_item(item_id: str):
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 644 bytes
    - Click Count (0)
  10. docs_src/handling_errors/tutorial001_py39.py

    from fastapi import FastAPI, HTTPException
    
    app = FastAPI()
    
    items = {"foo": "The Foo Wrestlers"}
    
    
    @app.get("/items/{item_id}")
    async def read_item(item_id: str):
        if item_id not in items:
            raise HTTPException(status_code=404, detail="Item not found")
    Created: Sun Dec 28 07:19:09 GMT 2025
    - Last Modified: Wed Dec 17 20:41:43 GMT 2025
    - 299 bytes
    - Click Count (0)
Back to Top