Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 43 for Ressin (0.17 sec)

  1. 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 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_websockets/test_tutorial002_an_py39.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 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  3. tests/test_tutorial/test_cookie_params/test_tutorial001_py310.py

            ("/items", {"ads_id": "ads_track"}, 200, {"ads_id": "ads_track"}),
            (
                "/items",
                {"ads_id": "ads_track", "session": "cookiesession"},
                200,
                {"ads_id": "ads_track"},
            ),
            ("/items", {"session": "cookiesession"}, 200, {"ads_id": None}),
        ],
    )
    def test(path, cookies, expected_status, expected_response):
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  4. docs/sts/client_grants/__init__.py

    from .sts_element import STSElement
    
    
    class ClientGrantsCredentialProvider(CredentialProvider):
        """
        ClientGrantsCredentialProvider implements CredentialProvider compatible
        implementation to be used with boto_session
        """
        METHOD = 'assume-role-client-grants'
        CANONICAL_NAME = 'AssumeRoleClientGrants'
    
        def __init__(self, cid, csec,
    Python
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Fri Apr 23 18:58:53 GMT 2021
    - 4.6K bytes
    - Viewed (1)
  5. tests/test_tutorial/test_sql_databases/test_sql_databases.py

        os.chdir(tmp_path)
        test_db = Path("./sql_app.db")
        if test_db.is_file():  # pragma: nocover
            test_db.unlink()
        # Import while creating the client to create the DB after starting the test session
        from docs_src.sql_databases.sql_app import main
    
        # Ensure import side effects are re-executed
        importlib.reload(main)
        with TestClient(main.app) as c:
            yield c
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.1K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_sql_databases/test_sql_databases_middleware_py310.py

        os.chdir(tmp_path)
        test_db = Path("./sql_app.db")
        if test_db.is_file():  # pragma: nocover
            test_db.unlink()
        # Import while creating the client to create the DB after starting the test session
        from docs_src.sql_databases.sql_app_py310 import alt_main
    
        # Ensure import side effects are re-executed
        importlib.reload(alt_main)
    
        with TestClient(alt_main.app) as c:
            yield c
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Wed Mar 13 19:07:10 GMT 2024
    - 16.5K bytes
    - Viewed (0)
  7. docs_src/sql_databases/sql_app_py310/main.py

        db_user = crud.get_user_by_email(db, email=user.email)
        if db_user:
            raise HTTPException(status_code=400, detail="Email already registered")
        return crud.create_user(db=db, user=user)
    
    
    @app.get("/users/", response_model=list[schemas.User])
    def read_users(skip: int = 0, limit: int = 100, db: Session = Depends(get_db)):
        users = crud.get_users(db, skip=skip, limit=limit)
        return users
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  8. tests/test_tutorial/test_websockets/test_tutorial002_an.py

    
    def test_websocket_with_cookie():
        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 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 3.6K bytes
    - Viewed (0)
  9. docs_src/websockets/tutorial002_py310.py

        return HTMLResponse(html)
    
    
    async def get_cookie_or_token(
        websocket: WebSocket,
        session: str | None = Cookie(default=None),
        token: str | None = Query(default=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(
        websocket: WebSocket,
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 2.7K bytes
    - Viewed (0)
  10. fastapi/security/api_key.py

        from fastapi.security import APIKeyCookie
    
        app = FastAPI()
    
        cookie_scheme = APIKeyCookie(name="session")
    
    
        @app.get("/items/")
        async def read_items(session: str = Depends(cookie_scheme)):
            return {"session": session}
        ```
        """
    
        def __init__(
            self,
            *,
            name: Annotated[str, Doc("Cookie name.")],
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 23 22:29:18 GMT 2024
    - 9.1K bytes
    - Viewed (0)
Back to top