- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 34 for KSession (0.2 sec)
-
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 May 05 07:19:11 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 2.7K bytes - Viewed (0) -
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 May 05 07:19:11 GMT 2024 - Last Modified: Tue Apr 23 22:29:18 GMT 2024 - 9.1K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001_an_py39.py
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) -
tests/test_tutorial/test_sql_databases/test_testing_databases_py39.py
os.chdir(tmp_path) test_db = Path("./test.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_py39.tests import test_sql_app # Ensure import side effects are re-executed importlib.reload(test_sql_app) test_sql_app.test_create_user()
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 822 bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_sql_databases_middleware_py39.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_py39 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) -
tests/test_tutorial/test_sql_databases/test_sql_databases_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 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.5K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_sql_databases_py39.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_py39 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.5K bytes - Viewed (0) -
docs_src/sql_databases/sql_app_py39/alt_main.py
from fastapi import Depends, FastAPI, HTTPException, Request, Response from sqlalchemy.orm import Session from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() @app.middleware("http") async def db_session_middleware(request: Request, call_next): response = Response("Internal server error", status_code=500) try:
Python - Registered: Sun May 05 07:19:11 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 1.9K bytes - Viewed (0) -
tests/test_tutorial/test_websockets/test_tutorial002.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: Sun Nov 13 14:26:09 GMT 2022 - 3.6K bytes - Viewed (0) -
tests/test_tutorial/test_cookie_params/test_tutorial001.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): client = TestClient(app, cookies=cookies)
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jul 07 17:12:13 GMT 2023 - 3.9K bytes - Viewed (0)