Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 177 for Ball (0.21 sec)

  1. docs/en/docs/tutorial/first-steps.md

    ```Python hl_lines="1"
    {!../../../docs_src/first_steps/tutorial001.py!}
    ```
    
    `FastAPI` is a Python class that provides all the functionality for your API.
    
    !!! note "Technical Details"
        `FastAPI` is a class that inherits directly from `Starlette`.
    
        You can use all the <a href="https://www.starlette.io/" class="external-link" target="_blank">Starlette</a> functionality with `FastAPI` too.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 9.2K bytes
    - Viewed (0)
  2. docs/en/docs/deployment/manually.md

    Just keep in mind that when you read "server" in general, it could refer to one of those two things.
    
    When referring to the remote machine, it's common to call it **server**, but also **machine**, **VM** (virtual machine), **node**. Those all refer to some type of remote machine, normally running Linux, where you run programs.
    
    ## Install the Server Program
    
    You can install an ASGI compatible server with:
    
    === "Uvicorn"
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 4.8K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/middleware.md

        If there were any background tasks (documented later), they will run *after* all the middleware.
    
    ## Create a middleware
    
    To create a middleware you use the decorator `@app.middleware("http")` on top of a function.
    
    The middleware function receives:
    
    * The `request`.
    * A function `call_next` that will receive the `request` as a parameter.
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  4. tests/test_dependency_class.py

    
    class CallableDependency:
        def __call__(self, value: str) -> str:
            return value
    
    
    class CallableGenDependency:
        def __call__(self, value: str) -> Generator[str, None, None]:
            yield value
    
    
    class AsyncCallableDependency:
        async def __call__(self, value: str) -> str:
            return value
    
    
    class AsyncCallableGenDependency:
        async def __call__(self, value: str) -> AsyncGenerator[str, None]:
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Aug 09 10:54:05 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  5. docs_src/middleware/tutorial001.py

    import time
    
    from fastapi import FastAPI, Request
    
    app = FastAPI()
    
    
    @app.middleware("http")
    async def add_process_time_header(request: Request, call_next):
        start_time = time.time()
        response = await call_next(request)
        process_time = time.time() - start_time
        response.headers["X-Process-Time"] = str(process_time)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 349 bytes
    - Viewed (0)
  6. tests/test_additional_properties_bool.py

    
    @app.post("/")
    async def post(
        foo: Union[Foo, None] = None,
    ):
        return foo
    
    
    client = TestClient(app)
    
    
    def test_call_invalid():
        response = client.post("/", json={"foo": {"bar": "baz"}})
        assert response.status_code == 422
    
    
    def test_call_valid():
        response = client.post("/", json={})
        assert response.status_code == 200
        assert response.json() == {}
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.2K bytes
    - Viewed (0)
  7. docs/zh/docs/advanced/advanced-dependencies.md

    假设要创建校验查询参数 `q` 是否包含固定内容的依赖项。
    
    但此处要把待检验的固定内容定义为参数。
    
    ## **可调用**实例
    
    Python 可以把类实例变为**可调用项**。
    
    这里说的不是类本身(类本就是可调用项),而是类实例。
    
    为此,需要声明 `__call__` 方法:
    
    ```Python hl_lines="10"
    {!../../../docs_src/dependencies/tutorial011.py!}
    ```
    
    本例中,**FastAPI**  使用 `__call__` 检查附加参数及子依赖项,稍后,还要调用它向*路径操作函数*传递值。
    
    ## 参数化实例
    
    接下来,使用 `__init__` 声明用于**参数化**依赖项的实例参数:
    
    ```Python hl_lines="7"
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:26:57 GMT 2024
    - 2K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/security/get-current-user.md

    But you can have thousands of endpoints (*path operations*) using the same security system.
    
    And all of them (or any portion of them that you want) can take the advantage of re-using these dependencies or any other dependencies you create.
    
    And all these thousands of *path operations* can be as small as 3 lines:
    
    === "Python 3.10+"
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 7.6K bytes
    - Viewed (0)
  9. docs_src/dependencies/tutorial011.py

    from fastapi import Depends, FastAPI
    
    app = FastAPI()
    
    
    class FixedContentQueryChecker:
        def __init__(self, fixed_content: str):
            self.fixed_content = fixed_content
    
        def __call__(self, q: str = ""):
            if q:
                return self.fixed_content in q
            return False
    
    
    checker = FixedContentQueryChecker("bar")
    
    
    @app.get("/query-checker/")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 504 bytes
    - Viewed (0)
  10. docs_src/sql_databases/sql_app_py39/crud.py

        return db.query(models.User).filter(models.User.email == email).first()
    
    
    def get_users(db: Session, skip: int = 0, limit: int = 100):
        return db.query(models.User).offset(skip).limit(limit).all()
    
    
    def create_user(db: Session, user: schemas.UserCreate):
        fake_hashed_password = user.password + "notreallyhashed"
        db_user = models.User(email=user.email, hashed_password=fake_hashed_password)
        db.add(db_user)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1K bytes
    - Viewed (0)
Back to top