- Sort Score
- Result 10 results
- Languages All
Results 441 - 450 of 1,108 for def2 (0.03 sec)
-
docs_src/websockets/tutorial002_an_py310.py
input.value = '' event.preventDefault() } </script> </body> </html> """ @app.get("/") async def get(): 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:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 2.8K bytes - Viewed (0) -
docs_src/websockets/tutorial002_py310.py
input.value = '' event.preventDefault() } </script> </body> </html> """ @app.get("/") async def get(): 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:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 2.7K bytes - Viewed (0) -
tests/test_tutorial/test_additional_responses/test_tutorial004.py
from docs_src.additional_responses.tutorial004 import app client = TestClient(app) def test_path_operation(): response = client.get("/items/foo") assert response.status_code == 200, response.text assert response.json() == {"id": "foo", "value": "there goes my hero"} def test_path_operation_img(): shutil.copy("./docs/en/docs/img/favicon.png", "./image.png")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 4.8K bytes - Viewed (0) -
tests/test_tutorial/test_generate_clients/test_tutorial003.py
from docs_src.generate_clients.tutorial003 import app client = TestClient(app) def test_post_items(): response = client.post("/items/", json={"name": "Foo", "price": 5}) assert response.status_code == 200, response.text assert response.json() == {"message": "Item received"} def test_post_users(): response = client.post( "/users/", json={"username": "Foo", "email": "******@****.***"}
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 7.1K bytes - Viewed (0) -
tests/test_tutorial/test_custom_request_and_route/test_tutorial002.py
from fastapi.testclient import TestClient from docs_src.custom_request_and_route.tutorial002 import app client = TestClient(app) def test_endpoint_works(): response = client.post("/", json=[1, 2, 3]) assert response.json() == 6 def test_exception_handler_body_access(): response = client.post("/", json={"numbers": [1, 2, 3]}) assert response.json() == IsDict( {
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 19:40:57 UTC 2024 - 1.2K bytes - Viewed (0) -
tests/test_tutorial/test_websockets/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.websockets.tutorial003 import app, html client = TestClient(app) def test_get(): response = client.get("/") assert response.text == html def test_websocket_handle_disconnection(): with client.websocket_connect("/ws/1234") as connection, client.websocket_connect( "/ws/5678" ) as connection_two: connection.send_text("Hello from 1234")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 29 09:26:07 UTC 2021 - 872 bytes - Viewed (0) -
docs_src/settings/app02_an_py39/main.py
from functools import lru_cache from typing import Annotated from fastapi import Depends, FastAPI from .config import Settings app = FastAPI() @lru_cache def get_settings(): return Settings() @app.get("/info") async def info(settings: Annotated[Settings, Depends(get_settings)]): return { "app_name": settings.app_name, "admin_email": settings.admin_email,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 445 bytes - Viewed (0) -
docs_src/custom_response/tutorial004.py
from fastapi import FastAPI from fastapi.responses import HTMLResponse app = FastAPI() def generate_html_response(): html_content = """ <html> <head> <title>Some HTML in here</title> </head> <body> <h1>Look ma! HTML!</h1> </body> </html> """ return HTMLResponse(content=html_content, status_code=200)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Mar 26 19:09:53 UTC 2020 - 491 bytes - Viewed (0) -
docs_src/settings/app02/test_main.py
from fastapi.testclient import TestClient from .config import Settings from .main import app, get_settings client = TestClient(app) def get_settings_override(): return Settings(admin_email="******@****.***") app.dependency_overrides[get_settings] = get_settings_override def test_app(): response = client.get("/info") data = response.json() assert data == { "app_name": "Awesome API",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Jul 29 09:26:07 UTC 2021 - 515 bytes - Viewed (0) -
tests/test_tutorial/test_settings/test_app02.py
from ...utils import needs_pydanticv2 @needs_pydanticv2 def test_settings(monkeypatch: MonkeyPatch): from docs_src.settings.app02 import main monkeypatch.setenv("ADMIN_EMAIL", "******@****.***") settings = main.get_settings() assert settings.app_name == "Awesome API" assert settings.items_per_user == 50 @needs_pydanticv2 def test_override_settings(): from docs_src.settings.app02 import test_main
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 488 bytes - Viewed (0)