Search Options

Results per page
Sort
Preferred Languages
Advance

Results 81 - 90 of 366 for Post (0.13 sec)

  1. docs_src/custom_request_and_route/tutorial002.py

                    raise HTTPException(status_code=422, detail=detail)
    
            return custom_route_handler
    
    
    app = FastAPI()
    app.router.route_class = ValidationErrorLoggingRoute
    
    
    @app.post("/")
    async def sum_numbers(numbers: List[int] = Body()):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 932 bytes
    - Viewed (0)
  2. docs_src/path_operation_advanced_configuration/tutorial004.py

    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        description: Union[str, None] = None
        price: float
        tax: Union[float, None] = None
        tags: Set[str] = set()
    
    
    @app.post("/items/", response_model=Item, summary="Create an item")
    async def create_item(item: Item):
        """
        Create an item with all the information:
    
        - **name**: each item must have a name
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 717 bytes
    - Viewed (0)
  3. docs/ja/docs/tutorial/response-model.md

    # レスポンスモデル
    
    *path operations* のいずれにおいても、`response_model`パラメータを使用して、レスポンスのモデルを宣言することができます:
    
    * `@app.get()`
    * `@app.post()`
    * `@app.put()`
    * `@app.delete()`
    * など。
    
    ```Python hl_lines="17"
    {!../../../docs_src/response_model/tutorial001.py!}
    ```
    
    !!! note "備考"
        `response_model`は「デコレータ」メソッド(`get`、`post`など)のパラメータであることに注意してください。すべてのパラメータやボディのように、*path operation関数* のパラメータではありません。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  4. docs/zh/docs/tutorial/first-steps.md

    #### 操作
    
    这里的「操作」指的是一种 HTTP「方法」。
    
    下列之一:
    
    * `POST`
    * `GET`
    * `PUT`
    * `DELETE`
    
    ...以及更少见的几种:
    
    * `OPTIONS`
    * `HEAD`
    * `PATCH`
    * `TRACE`
    
    在 HTTP 协议中,你可以使用以上的其中一种(或多种)「方法」与每个路径进行通信。
    
    ---
    
    在开发 API 时,你通常使用特定的 HTTP 方法去执行特定的行为。
    
    通常使用:
    
    * `POST`:创建数据。
    * `GET`:读取数据。
    * `PUT`:更新数据。
    * `DELETE`:删除数据。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 12 00:06:16 GMT 2022
    - 9.2K bytes
    - Viewed (0)
  5. docs_src/extra_models/tutorial002.py

        hashed_password = fake_password_hasher(user_in.password)
        user_in_db = UserInDB(**user_in.dict(), hashed_password=hashed_password)
        print("User saved! ..not really")
        return user_in_db
    
    
    @app.post("/user/", response_model=UserOut)
    async def create_user(user_in: UserIn):
        user_saved = fake_save_user(user_in)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 824 bytes
    - Viewed (0)
  6. tests/test_operations_signatures.py

    import inspect
    
    from fastapi import APIRouter, FastAPI
    
    method_names = ["get", "put", "post", "delete", "options", "head", "patch", "trace"]
    
    
    def test_signatures_consistency():
        base_sig = inspect.signature(APIRouter.get)
        for method_name in method_names:
            router_method = getattr(APIRouter, method_name)
            app_method = getattr(FastAPI, method_name)
            router_sig = inspect.signature(router_method)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon May 27 12:08:13 GMT 2019
    - 934 bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/cors.md

    你可以在 **FastAPI** 应用中使用 `CORSMiddleware` 来配置它。
    
    * 导入 `CORSMiddleware`。
    * 创建一个允许的源列表(由字符串组成)。
    * 将其作为「中间件」添加到你的 **FastAPI** 应用中。
    
    你也可以指定后端是否允许:
    
    * 凭证(授权 headers,Cookies 等)。
    * 特定的 HTTP 方法(`POST`,`PUT`)或者使用通配符 `"*"` 允许所有方法。
    * 特定的 HTTP headers 或者使用通配符 `"*"` 允许所有 headers。
    
    ```Python hl_lines="2  6-11  13-19"
    {!../../../docs_src/cors/tutorial001.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 27 17:28:07 GMT 2021
    - 4.5K bytes
    - Viewed (0)
  8. docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py

            yield db
        finally:
            db.close()
    
    
    app.dependency_overrides[get_db] = override_get_db
    
    client = TestClient(app)
    
    
    def test_create_user():
        response = client.post(
            "/users/",
            json={"email": "******@****.***", "password": "chimichangas4life"},
        )
        assert response.status_code == 200, response.text
        data = response.json()
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.2K bytes
    - Viewed (0)
  9. docs/ko/docs/tutorial/cors.md

    * `CORSMiddleware` 임포트.
    * 허용되는 출처(문자열 형식)의 리스트 생성.
    * FastAPI 응용 프로그램에 "미들웨어(middleware)"로 추가.
    
    백엔드에서 다음의 사항을 허용할지에 대해 설정할 수도 있습니다:
    
    * 자격증명 (인증 헤더, 쿠키 등).
    * 특정한 HTTP 메소드(`POST`, `PUT`) 또는 와일드카드 `"*"` 를 사용한 모든 HTTP 메소드.
    * 특정한 HTTP 헤더 또는 와일드카드 `"*"` 를 사용한 모든 HTTP 헤더.
    
    ```Python hl_lines="2  6-11  13-19"
    {!../../../docs_src/cors/tutorial001.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jan 07 14:21:23 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/testing.md

    │   ├── main.py
    │   └── test_main.py
    ```
    
    Let's say that now the file `main.py` with your **FastAPI** app has some other **path operations**.
    
    It has a `GET` operation that could return an error.
    
    It has a `POST` operation that could return several errors.
    
    Both *path operations* require an `X-Token` header.
    
    === "Python 3.10+"
    
        ```Python
        {!> ../../../docs_src/app_testing/app_b_an_py310/main.py!}
        ```
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
Back to top