Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 80 for we (0.15 sec)

  1. docs/en/docs/advanced/path-operation-advanced-configuration.md

    Nevertheless, although we are not using the default integrated functionality, we are still using a Pydantic model to manually generate the JSON Schema for the data that we want to receive in YAML.
    
    Then we use the request directly, and extract the body as `bytes`. This means that FastAPI won't even try to parse the request payload as JSON.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.7K bytes
    - Viewed (0)
  2. docs/en/docs/advanced/security/oauth2-scopes.md

        ```
    
    ## Verify the `username` and data shape
    
    We verify that we get a `username`, and extract the scopes.
    
    And then we validate that data with the Pydantic model (catching the `ValidationError` exception), and if we get an error reading the JWT token or validating the data with Pydantic, we raise the `HTTPException` we created before.
    
    For that, we update the Pydantic model `TokenData` with a new property `scopes`.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 21:21:35 GMT 2024
    - 20.5K bytes
    - Viewed (0)
  3. docs/en/docs/how-to/sql-databases-peewee.md

    ```
    
    There are some differences with the code for the SQLAlchemy tutorial.
    
    We don't pass a `db` attribute around. Instead we use the models directly. This is because the `db` object is a global object, that includes all the connection logic. That's why we had to do all the `contextvars` updates above.
    
    Aso, when returning several objects, like in `get_users`, we directly call `list`, like in:
    
    ```Python
    list(models.User.select())
    ```
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (0)
  4. docs/en/docs/tutorial/security/simple-oauth2.md

        ```
    
    ### Check the password
    
    At this point we have the user data from our database, but we haven't checked the password.
    
    Let's put that data in the Pydantic `UserInDB` model first.
    
    You should never save plaintext passwords, so, we'll use the (fake) password hashing system.
    
    If the passwords don't match, we return the same error.
    
    #### Password hashing
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  5. docs/en/docs/advanced/async-tests.md

    The `TestClient` is based on <a href="https://www.python-httpx.org" class="external-link" target="_blank">HTTPX</a>, and luckily, we can use it directly to test the API.
    
    ## Example
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Jan 13 12:07:15 GMT 2024
    - 3.9K bytes
    - Viewed (0)
  6. fastapi/concurrency.py

        # can create race conditions/deadlocks if the context manager itself
        # has its own internal pool (e.g. a database connection pool)
        # to avoid this we let __exit__ run without a capacity limit
        # since we're creating a new limiter for each call, any non-zero limit
        # works (1 is arbitrary)
        exit_limiter = CapacityLimiter(1)
        try:
            yield await run_in_threadpool(cm.__enter__)
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Mon Dec 25 17:57:35 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  7. docs_src/response_cookies/tutorial002.py

    app = FastAPI()
    
    
    @app.post("/cookie-and-object/")
    def create_cookie(response: Response):
        response.set_cookie(key="fakesession", value="fake-cookie-session-value")
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 272 bytes
    - Viewed (0)
  8. docs/en/docs/deployment/docker.md

    Then, near the end of the `Dockerfile`, we copy all the code. As this is what **changes most frequently**, we put it near the end, because almost always, anything after this step will not be able to use the cache.
    
    ```Dockerfile
    COPY ./app /code/app
    ```
    
    ### Build the Docker Image
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 34.3K bytes
    - Viewed (0)
  9. tests/test_tutorial/test_response_cookies/test_tutorial001.py

    client = TestClient(app)
    
    
    def test_path_operation():
        response = client.post("/cookie/")
        assert response.status_code == 200, response.text
        assert response.json() == {"message": "Come to the dark side, we have cookies"}
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Jul 09 18:06:12 GMT 2020
    - 403 bytes
    - Viewed (0)
  10. docs/en/docs/tutorial/extra-models.md

    So, if we create a Pydantic object `user_in` like:
    
    ```Python
    user_in = UserIn(username="john", password="secret", email="******@****.***")
    ```
    
    and then we call:
    
    ```Python
    user_dict = user_in.dict()
    ```
    
    we now have a `dict` with the data in the variable `user_dict` (it's a `dict` instead of a Pydantic model object).
    
    And if we call:
    
    ```Python
    print(user_dict)
    ```
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.7K bytes
    - Viewed (1)
Back to top