Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 83 for now (0.17 sec)

  1. docs_src/security/tutorial005_an_py310.py

        return user
    
    
    def create_access_token(data: dict, expires_delta: timedelta | None = None):
        to_encode = data.copy()
        if expires_delta:
            expire = datetime.now(timezone.utc) + expires_delta
        else:
            expire = datetime.now(timezone.utc) + timedelta(minutes=15)
        to_encode.update({"exp": expire})
        encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
        return encoded_jwt
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 5.2K bytes
    - Viewed (0)
  2. docs/en/docs/how-to/sql-databases-peewee.md

        You would do the same for any other Peewee database, including `PostgresqlDatabase`, `MySQLDatabase`, etc.
    
    ## Create the database models
    
    Let's now see the file `sql_app/models.py`.
    
    ### Create Peewee models for our data
    
    Now create the Peewee models (classes) for `User` and `Item`.
    
    This is the same you would do if you followed the Peewee tutorial and updated the models to have the same data as in the SQLAlchemy tutorial.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (1)
  3. docs/en/docs/tutorial/sql-databases.md

    ```
    
    ### Create a `Base` class
    
    Now we will use the function `declarative_base()` that returns a class.
    
    Later we will inherit from this class to create each of the database models or classes (the ORM models):
    
    ```Python hl_lines="13"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    ## Create the database models
    
    Let's now see the file `sql_app/models.py`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/security/oauth2-scopes.md

        ```Python hl_lines="2  4  8  12  46  64  105  107-115  121-124  128-134  139  155"
        {!> ../../../docs_src/security/tutorial005.py!}
        ```
    
    Now let's review those changes step by step.
    
    ## OAuth2 Security scheme
    
    The first change is that now we are declaring the OAuth2 security scheme with two available scopes, `me` and `items`.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Jan 11 21:21:35 GMT 2024
    - 20.5K bytes
    - Viewed (0)
  5. docs_src/websockets/tutorial003_py39.py

                <input type="text" id="messageText" autocomplete="off"/>
                <button>Send</button>
            </form>
            <ul id='messages'>
            </ul>
            <script>
                var client_id = Date.now()
                document.querySelector("#ws-id").textContent = client_id;
                var ws = new WebSocket(`ws://localhost:8000/ws/${client_id}`);
                ws.onmessage = function(event) {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.5K bytes
    - Viewed (0)
  6. docs/en/docs/how-to/extending-openapi.md

    ```Python hl_lines="2  15-21"
    {!../../../docs_src/extending_openapi/tutorial001.py!}
    ```
    
    ### Modify the OpenAPI schema
    
    Now you can add the ReDoc extension, adding a custom `x-logo` to the `info` "object" in the OpenAPI schema:
    
    ```Python hl_lines="22-24"
    {!../../../docs_src/extending_openapi/tutorial001.py!}
    ```
    
    ### Cache the OpenAPI schema
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Aug 19 19:54:04 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  7. docs_src/security/tutorial004_py310.py

        return user
    
    
    def create_access_token(data: dict, expires_delta: timedelta | None = None):
        to_encode = data.copy()
        if expires_delta:
            expire = datetime.now(timezone.utc) + expires_delta
        else:
            expire = datetime.now(timezone.utc) + timedelta(minutes=15)
        to_encode.update({"exp": expire})
        encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
        return encoded_jwt
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 4K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/settings.md

    Coming from the previous example, your `config.py` file could look like:
    
    ```Python hl_lines="10"
    {!../../../docs_src/settings/app02/config.py!}
    ```
    
    Notice that now we don't create a default instance `settings = Settings()`.
    
    ### The main app file
    
    Now we create a dependency that returns a new `config.Settings()`.
    
    === "Python 3.9+"
    
        ```Python hl_lines="6  12-13"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu May 02 22:37:31 GMT 2024
    - 15.7K bytes
    - Viewed (0)
  9. docs/en/docs/tutorial/extra-data-types.md

    # Extra Data Types
    
    Up to now, you have been using common data types, like:
    
    * `int`
    * `float`
    * `str`
    * `bool`
    
    But you can also use more complex data types.
    
    And you will still have the same features as seen up to now:
    
    * Great editor support.
    * Data conversion from incoming requests.
    * Data conversion for response data.
    * Data validation.
    * Automatic annotation and documentation.
    
    ## Other data types
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 4.1K bytes
    - Viewed (0)
  10. docs/en/docs/how-to/separate-openapi-schemas.md

    ## Do not Separate Schemas
    
    Now, there are some cases where you might want to have the **same schema for input and output**.
    
    Probably the main use case for this is if you already have some autogenerated client code/SDKs and you don't want to update all the autogenerated client code/SDKs yet, you probably will want to do it at some point, but maybe not right now.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 6.7K bytes
    - Viewed (0)
Back to top