Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 113 for Dadd (0.2 sec)

  1. docs/en/docs/tutorial/middleware.md

    ### Before and after the `response`
    
    You can add code to be run with the `request`,  before any *path operation* receives it.
    
    And also after the `response` is generated, before returning it.
    
    For example, you could add a custom header `X-Process-Time` containing the time in seconds that it took to process the request and generate a response:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 16:31:18 GMT 2024
    - 2.9K bytes
    - Viewed (0)
  2. docs_src/graphql/tutorial001.py

        def user(self) -> User:
            return User(name="Patrick", age=100)
    
    
    schema = strawberry.Schema(query=Query)
    
    
    graphql_app = GraphQL(schema)
    
    app = FastAPI()
    app.add_route("/graphql", graphql_app)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Oct 03 18:00:28 GMT 2021
    - 446 bytes
    - Viewed (0)
  3. docs_src/background_tasks/tutorial002_an_py310.py

        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    async def send_notification(
        email: str, background_tasks: BackgroundTasks, q: Annotated[str, Depends(get_query)]
    ):
        message = f"message to {email}\n"
        background_tasks.add_task(write_log, message)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 683 bytes
    - Viewed (1)
  4. docs/en/docs/advanced/middleware.md

    For that, you use `app.add_middleware()` (as in the example for CORS).
    
    ```Python
    from fastapi import FastAPI
    from unicorn import UnicornMiddleware
    
    app = FastAPI()
    
    app.add_middleware(UnicornMiddleware, some_config="rainbow")
    ```
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Mar 10 18:27:10 GMT 2023
    - 4K bytes
    - Viewed (0)
  5. docs_src/sql_databases/sql_app_py39/crud.py

        db.add(db_user)
        db.commit()
        db.refresh(db_user)
        return db_user
    
    
    def get_items(db: Session, skip: int = 0, limit: int = 100):
        return db.query(models.Item).offset(skip).limit(limit).all()
    
    
    def create_user_item(db: Session, item: schemas.ItemCreate, user_id: int):
        db_item = models.Item(**item.dict(), owner_id=user_id)
        db.add(db_item)
        db.commit()
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1K bytes
    - Viewed (0)
  6. docs/en/docs/advanced/testing-database.md

    So we add that line here, with the new file.
    
    ```Python hl_lines="16"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    ## Dependency override
    
    Now we create the dependency override and add it to the overrides for our app.
    
    ```Python hl_lines="19-24  27"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  7. docs/en/docs/deployment/versions.md

    ## About versions
    
    Following the Semantic Versioning conventions, any version below `1.0.0` could potentially add breaking changes.
    
    FastAPI also follows the convention that any "PATCH" version change is for bug fixes and non-breaking changes.
    
    !!! tip
        The "PATCH" is the last number, for example, in `0.2.3`, the PATCH version is `3`.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Nov 05 20:50:37 GMT 2020
    - 3.3K bytes
    - Viewed (0)
  8. 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 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 349 bytes
    - Viewed (0)
  9. docs/en/docs/contributing.md

    Now you can translate it all and see how it looks as you save the file.
    
    #### New Language
    
    Let's say that you want to add translations for a language that is not yet translated, not even some pages.
    
    Let's say you want to add translations for Creole, and it's not yet there in the docs.
    
    Checking the link from above, the code for "Creole" is `ht`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jan 11 17:42:43 GMT 2024
    - 14.1K bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/testing.md

    ```Python hl_lines="3"
    {!../../../docs_src/app_testing/test_main.py!}
    ```
    
    ...and have the code for the tests just like before.
    
    ## Testing: extended example
    
    Now let's extend this example and add more details to see how to test different parts.
    
    ### Extended **FastAPI** app file
    
    Let's continue with the same file structure as before:
    
    ```
    .
    ├── app
    │   ├── __init__.py
    │   ├── main.py
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
Back to top