- Sort Score
- Result 10 results
- Languages All
Results 431 - 440 of 1,107 for def2 (0.04 sec)
-
docs_src/dependencies/tutorial002_an_py39.py
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}] class CommonQueryParams: def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100): self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]): response = {} if commons.q:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 677 bytes - Viewed (0) -
docs_src/dependencies/tutorial003_an_py39.py
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}] class CommonQueryParams: def __init__(self, q: Union[str, None] = None, skip: int = 0, limit: int = 100): self.q = q self.skip = skip self.limit = limit @app.get("/items/") async def read_items(commons: Annotated[Any, Depends(CommonQueryParams)]): response = {} if commons.q:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 668 bytes - Viewed (0) -
tests/test_fastapi_cli.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 02 06:03:05 UTC 2024 - 790 bytes - Viewed (0) -
tests/test_tutorial/test_custom_response/test_tutorial006.py
from docs_src.custom_response.tutorial006 import app client = TestClient(app) def test_get(): response = client.get("/typer", follow_redirects=False) assert response.status_code == 307, response.text assert response.headers["location"] == "https://typer.tiangolo.com" def test_openapi_schema(): response = client.get("/openapi.json") assert response.status_code == 200, response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1K bytes - Viewed (0) -
tests/test_typing_python39.py
from fastapi import FastAPI from fastapi.testclient import TestClient from .utils import needs_py310 @needs_py310 def test_typing(): types = { list[int]: [1, 2, 3], dict[str, list[int]]: {"a": [1, 2, 3], "b": [4, 5, 6]}, set[int]: [1, 2, 3], # `set` is converted to `list` tuple[int, ...]: [1, 2, 3], # `tuple` is converted to `list` } for test_type, expect in types.items():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 709 bytes - Viewed (0) -
docs_src/request_files/tutorial001_an_py39.py
from typing import Annotated from fastapi import FastAPI, File, UploadFile app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File()]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file(file: UploadFile):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 322 bytes - Viewed (0) -
tests/test_tutorial/test_configure_swagger_ui/test_tutorial002.py
from fastapi.testclient import TestClient from docs_src.configure_swagger_ui.tutorial002 import app client = TestClient(app) def test_swagger_ui(): response = client.get("/docs") assert response.status_code == 200, response.text assert ( '"syntaxHighlight": false' not in response.text ), "not used parameters should not be included" assert ( '"syntaxHighlight.theme": "obsidian"' in response.text
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 19 19:54:04 UTC 2023 - 1.5K bytes - Viewed (0) -
docs_src/settings/app02/main.py
from functools import lru_cache 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: Settings = Depends(get_settings)): return { "app_name": settings.app_name, "admin_email": settings.admin_email, "items_per_user": settings.items_per_user,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Oct 24 20:26:06 UTC 2023 - 406 bytes - Viewed (0) -
fastapi/routing.py
return decorator def websocket_route( self, path: str, name: Union[str, None] = None ) -> Callable[[DecoratedCallable], DecoratedCallable]: def decorator(func: DecoratedCallable) -> DecoratedCallable: self.add_websocket_route(path, func, name=name) return func return decorator def include_router( self,
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Oct 12 09:44:57 UTC 2024 - 172.1K bytes - Viewed (0) -
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)