Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 73 for KSession (0.17 sec)

  1. docs_src/sql_databases/sql_app_py39/crud.py

    from sqlalchemy.orm import Session
    
    from . import models, schemas
    
    
    def get_user(db: Session, user_id: int):
        return db.query(models.User).filter(models.User.id == user_id).first()
    
    
    def get_user_by_email(db: Session, email: str):
        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()
    
    
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_websockets/test_tutorial002_py310.py

    def test_websocket_with_cookie(app: FastAPI):
        client = TestClient(app, cookies={"session": "fakesession"})
        with pytest.raises(WebSocketDisconnect):
            with client.websocket_connect("/items/foo/ws") as websocket:
                message = "Message one"
                websocket.send_text(message)
                data = websocket.receive_text()
                assert data == "Session cookie or query token value is: fakesession"
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  3. docs_src/websockets/tutorial002_an_py310.py

        return HTMLResponse(html)
    
    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: Annotated[str | None, Cookie()] = None,
        token: Annotated[str | None, Query()] = None,
    ):
        if session is None and token is None:
            raise WebSocketException(code=status.WS_1008_POLICY_VIOLATION)
        return session or token
    
    
    @app.websocket("/items/{item_id}/ws")
    async def websocket_endpoint(
        *,
    Python
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  4. docs/en/docs/advanced/testing-database.md

        └── tests
            ├── __init__.py
            └── test_sql_app.py
    ```
    
    ## Create the new database session
    
    First, we create a new database session with the new database.
    
    We'll use an in-memory database that persists during the tests instead of the local file `sql_app.db`.
    
    But the rest of the session code is more or less the same, we just copy it.
    
    ```Python hl_lines="8-13"
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  5. .github/workflows/latest-changes.yml

            with:
              # To allow latest-changes to commit to the main branch
              token: ${{ secrets.FASTAPI_LATEST_CHANGES }}
          # Allow debugging with tmate
          - name: Setup tmate session
            uses: mxschmitt/action-tmate@v3
            if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled == 'true' }}
            with:
              limit-access-to-actor: true
    Others
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Tue Jan 09 14:57:33 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/sql-databases.md

    ### 创建一个`SessionLocal`类
    
    每个实例`SessionLocal`都会是一个数据库会话。当然该类本身还不是数据库会话。
    
    但是一旦我们创建了一个`SessionLocal`类的实例,这个实例将是实际的数据库会话。
    
    我们命名它是`SessionLocal`为了将它与我们从 SQLAlchemy 导入的`Session`区别开来。
    
    稍后我们将使用`Session`(从 SQLAlchemy 导入的那个)。
    
    要创建`SessionLocal`类,请使用函数`sessionmaker`:
    
    ```Python hl_lines="11"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    ### 创建一个`Base`类
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  7. docs/vi/docs/features.md

    * API keys in:
        * Headers.
        * Các tham số trong query string.
        * Cookies, etc.
    
    Cộng với tất cả các tính năng bảo mật từ Starlette (bao gồm **session cookies**).
    
    Tất cả được xây dựng dưới dạng các công cụ và thành phần có thể tái sử dụng, dễ dàng tích hợp với hệ thống, kho lưu trữ dữ liệu, cơ sở dữ liệu quan hệ và NoSQL của bạn,...
    
    ### Dependency Injection
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  8. docs/en/docs/tutorial/testing.md

    </div>
    
    It will detect the files and tests automatically, execute them, and report the results back to you.
    
    Run the tests with:
    
    <div class="termy">
    
    ```console
    $ pytest
    
    ================ test session starts ================
    platform linux -- Python 3.6.9, pytest-5.3.5, py-1.8.1, pluggy-0.13.1
    rootdir: /home/user/code/superawesome-cli/app
    plugins: forked-1.1.3, xdist-1.31.0, cov-2.8.1
    collected 6 items
    
    ---> 100%
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 6.2K bytes
    - Viewed (0)
  9. docs/en/docs/alternatives.md

    * Seriously impressive performance.
    * WebSocket support.
    * In-process background tasks.
    * Startup and shutdown events.
    * Test client built on HTTPX.
    * CORS, GZip, Static Files, Streaming responses.
    * Session and Cookie support.
    * 100% test coverage.
    * 100% type annotated codebase.
    * Few hard dependencies.
    
    Plain Text
    - Registered: Sun Apr 21 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 23.2K bytes
    - Viewed (0)
  10. docs_src/sql_databases/sql_app_py310/crud.py

    from sqlalchemy.orm import Session
    
    from . import models, schemas
    
    
    def get_user(db: Session, user_id: int):
        return db.query(models.User).filter(models.User.id == user_id).first()
    
    
    def get_user_by_email(db: Session, email: str):
        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()
    
    
    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