Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 80 for We (0.18 sec)

  1. docs/en/docs/tutorial/bigger-applications.md

    We are going to include this `APIRouter` in the main `FastAPI` app, but first, let's check the dependencies and another `APIRouter`.
    
    ## Dependencies
    
    We see that we are going to need some dependencies used in several places of the application.
    
    So we put them in their own `dependencies` module (`app/dependencies.py`).
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18.6K bytes
    - Viewed (0)
  2. docs/en/docs/how-to/nosql-databases-couchbase.md

    ```
    
    ## Create Pydantic models
    
    As **Couchbase** "documents" are actually just "JSON objects", we can model them with Pydantic.
    
    ### `User` model
    
    First, let's create a `User` model:
    
    ```Python hl_lines="24-28"
    {!../../../docs_src/nosql_databases/tutorial001.py!}
    ```
    
    We will use this model in our *path operation function*, so, we don't include in it the `hashed_password`.
    
    ### `UserInDB` model
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 6K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/security/first-steps.md

    We can use **OAuth2** to build that with **FastAPI**.
    
    But let's save you the time of reading the full long specification just to find those little pieces of information you need.
    
    Let's use the tools provided by **FastAPI** to handle security.
    
    ## How it looks
    
    Let's first just use the code and see how it works, and then we'll come back to understand what's happening.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:02:19 GMT 2024
    - 8.9K bytes
    - Viewed (0)
  4. docs/en/docs/how-to/custom-request-and-route.md

    We can also use this same approach to access the request body in an exception handler.
    
    All we need to do is handle the request inside a `try`/`except` block:
    
    ```Python hl_lines="13  15"
    {!../../../docs_src/custom_request_and_route/tutorial002.py!}
    ```
    
    If an exception occurs, the`Request` instance will still be in scope, so we can read and make use of the request body when handling the error:
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Mar 31 23:52:53 GMT 2024
    - 4.4K bytes
    - Viewed (0)
  5. docs/en/docs/how-to/async-sql-encode-databases.md

        "completed": False,
    }
    ```
    
    but it doesn't have the `id` field.
    
    So we create a new `dict`, that contains the key-value pairs from `note.dict()` with:
    
    ```Python
    {**note.dict()}
    ```
    
    `**note.dict()` "unpacks" the key value pairs directly, so, `{**note.dict()}` would be, more or less, a copy of `note.dict()`.
    
    And then, we extend that copy `dict`, adding another key-value pair: `"id": last_record_id`:
    
    ```Python
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  6. docs/en/docs/deployment/concepts.md

    ### We Make Mistakes
    
    We, as humans, make **mistakes**, all the time. Software almost *always* has **bugs** hidden in different places. 🐛
    
    And we as developers keep improving the code as we find those bugs and as we implement new features (possibly adding new bugs too 😅).
    
    ### Small Errors Automatically Handled
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 18K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/security/oauth2-jwt.md

    # OAuth2 with Password (and hashing), Bearer with JWT tokens
    
    Now that we have all the security flow, let's make the application actually secure, using <abbr title="JSON Web Tokens">JWT</abbr> tokens and secure password hashing.
    
    This code is something you can actually use in your application, save the password hashes in your database, etc.
    
    We are going to start from where we left in the previous chapter and increment it.
    
    ## About JWT
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 13K bytes
    - Viewed (0)
  8. docs/en/docs/how-to/conditional-openapi.md

    For example:
    
    ```Python hl_lines="6  11"
    {!../../../docs_src/conditional_openapi/tutorial001.py!}
    ```
    
    Here we declare the setting `openapi_url` with the same default of `"/openapi.json"`.
    
    And then we use it when creating the `FastAPI` app.
    
    Then you could disable OpenAPI (including the UI docs) by setting the environment variable `OPENAPI_URL` to the empty string, like:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 2.3K bytes
    - Viewed (0)
  9. tests/test_webhooks_security.py

        start_date: datetime
    
    
    @app.webhooks.post("new-subscription")
    def new_subscription(
        body: Subscription, token: Annotated[str, Security(bearer_scheme)]
    ):
        """
        When a new user subscribes to your service we'll send you a POST request with this
        data to the URL that you register for the event `new-subscription` in the dashboard.
        """
    
    
    client = TestClient(app)
    
    
    def test_dummy_webhook():
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Oct 20 09:00:44 GMT 2023
    - 4.6K bytes
    - Viewed (0)
  10. docs_src/dependencies/tutorial008c_an.py

    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    class InternalError(Exception):
        pass
    
    
    def get_username():
        try:
            yield "Rick"
        except InternalError:
            print("Oops, we didn't raise again, Britney 😱")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id == "portal-gun":
            raise InternalError(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 710 bytes
    - Viewed (0)
Back to top