Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 118 for Pound (0.32 sec)

  1. docs_src/app_testing/app_b_an/test_main.py

    
    def test_read_nonexistent_item():
        response = client.get("/items/baz", headers={"X-Token": "coneofsilence"})
        assert response.status_code == 404
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_create_item():
        response = client.post(
            "/items/",
            headers={"X-Token": "coneofsilence"},
            json={"id": "foobar", "title": "Foo Bar", "description": "The Foo Barters"},
        )
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 1.8K bytes
    - Viewed (0)
  2. docs/en/docs/alternatives.md

    Right before deciding to build **FastAPI** I found **APIStar** server. It had almost everything I was looking for and had a great design.
    
    It was one of the first implementations of a framework using Python type hints to declare parameters and requests that I ever saw (before NestJS and Molten). I found it more or less at the same time as Hug. But APIStar used the OpenAPI standard.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23.2K bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/handling-errors.md

    ```JSON
    {
      "item": "The Foo Wrestlers"
    }
    ```
    
    しかし、クライアントが`http://example.com/items/bar`(存在しない`item_id` `"bar"`)をリクエストした場合、HTTPステータスコード404("not found"エラー)と以下のJSONレスポンスが返されます:
    
    ```JSON
    {
      "detail": "Item not found"
    }
    ```
    
    !!! tip "豆知識"
        `HTTPException`を発生させる際には、`str`だけでなく、JSONに変換できる任意の値を`detail`パラメータとして渡すことができます。
    
        `dist`や`list`などを渡すことができます。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.8K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/handling-errors.md

    - 客户端没有执行操作的权限
    - 客户端没有访问资源的权限
    - 客户端要访问的项目不存在
    - 等等 ...
    
    遇到这些情况时,通常要返回 **4XX**(400 至 499)**HTTP 状态码**。
    
    **4XX** 状态码与表示请求成功的 **2XX**(200 至 299) HTTP 状态码类似。
    
    只不过,**4XX** 状态码表示客户端发生的错误。
    
    大家都知道**「404 Not Found」**错误,还有调侃这个错误的笑话吧?
    
    ## 使用 `HTTPException`
    
    向客户端返回 HTTP 错误响应,可以使用 `HTTPException`。
    
    ### 导入 `HTTPException`
    
    ```Python hl_lines="1"
    {!../../../docs_src/handling_errors/tutorial001.py!}
    
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  5. docs/en/docs/deployment/manually.md

     │  🐍 main.py          │
     │                      │
     ╰──────────────────────╯
    
    <font color="#3465A4">INFO    </font> Importing module <font color="#4E9A06">main</font>
    <font color="#3465A4">INFO    </font> Found importable FastAPI app
    
     ╭─ <font color="#8AE234"><b>Importable FastAPI app</b></font> ─╮
     │                          │
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 9.2K bytes
    - Viewed (0)
  6. docs/em/docs/tutorial/handling-errors.md

    {
      "item": "The Foo Wrestlers"
    }
    ```
    
    ✋️ 🚥 👩‍💻 📨 `http://example.com/items/bar` (🚫-🚫 `item_id` `"bar"`), 👈 👩‍💻 🔜 📨 🇺🇸🔍 👔 📟 4️⃣0️⃣4️⃣ ("🚫 🔎" ❌), &amp; 🎻 📨:
    
    ```JSON
    {
      "detail": "Item not found"
    }
    ```
    
    !!! tip
        🕐❔ 🙋‍♀ `HTTPException`, 👆 💪 🚶‍♀️ 🙆 💲 👈 💪 🗜 🎻 🔢 `detail`, 🚫 🕴 `str`.
    
        👆 💪 🚶‍♀️ `dict`, `list`, ♒️.
    
        👫 🍵 🔁 **FastAPI** &amp; 🗜 🎻.
    
    ## 🚮 🛃 🎚
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/first-steps.md

     │  🐍 main.py          │
     │                      │
     ╰──────────────────────╯
    
    <font color="#3465A4">INFO    </font> Importing module <font color="#4E9A06">main</font>
    <font color="#3465A4">INFO    </font> Found importable FastAPI app
    
     ╭─ <font color="#8AE234"><b>Importable FastAPI app</b></font> ─╮
     │                          │
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 12K bytes
    - Viewed (0)
  8. tests/test_starlette_exception.py

            raise StarletteHTTPException(status_code=404, detail="Item not found")
        return {"item": items[item_id]}
    
    
    client = TestClient(app)
    
    
    def test_get_item():
        response = client.get("/items/foo")
        assert response.status_code == 200, response.text
        assert response.json() == {"item": "The Foo Wrestlers"}
    
    
    def test_get_item_not_found():
        response = client.get("/items/bar")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 7.4K bytes
    - Viewed (0)
  9. docs_src/additional_responses/tutorial003.py

    class Message(BaseModel):
        message: str
    
    
    app = FastAPI()
    
    
    @app.get(
        "/items/{item_id}",
        response_model=Item,
        responses={
            404: {"model": Message, "description": "The item was not found"},
            200: {
                "description": "Item requested by ID",
                "content": {
                    "application/json": {
                        "example": {"id": "bar", "value": "The bar tenders"}
                    }
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 837 bytes
    - Viewed (0)
  10. tests/test_tutorial/test_handling_errors/test_tutorial002.py

        assert response.json() == {"item": "The Foo Wrestlers"}
    
    
    def test_get_item_not_found_header():
        response = client.get("/items-header/bar")
        assert response.status_code == 404, response.text
        assert response.headers.get("x-error") == "There goes my error"
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.3K bytes
    - Viewed (0)
Back to top