- Sort Score
- Result 10 results
- Languages All
Results 451 - 460 of 1,107 for def2 (0.02 sec)
-
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_events/test_tutorial003.py
from fastapi.testclient import TestClient from docs_src.events.tutorial003 import ( app, fake_answer_to_everything_ml_model, ml_models, ) def test_events(): assert not ml_models, "ml_models should be empty" with TestClient(app) as client: assert ml_models["answer_to_everything"] == fake_answer_to_everything_ml_model response = client.get("/predict", params={"x": 2})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 3.6K bytes - Viewed (0) -
docs/em/docs/advanced/dataclasses.md
7ī¸âŖ. đĨ `response_model` âī¸ đ â đ `Author` đģ. đ, đ đĒ đ `dataclasses` âŽī¸ đŠ đ â. 8ī¸âŖ. đ đ đ *⥠đ ī¸ đĸ* âī¸ đĨ `def` âŠī¸ `async def`. đ§, FastAPI đ đĒ đ `def` & `async def` đĒ. đĨ đ đĒ âī¸ đ đâ âī¸ â, â đ đ _"đ â" _ đŠē đ <a href="https://fastapi.tiangolo.com/async/#in-a-hurry" target="_blank" class="internal-link">`async` & `await`</a>.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 3.4K bytes - Viewed (0) -
docs_src/request_files/tutorial001_03_an.py
from fastapi import FastAPI, File, UploadFile from typing_extensions import Annotated app = FastAPI() @app.post("/files/") async def create_file(file: Annotated[bytes, File(description="A file read as bytes")]): return {"file_size": len(file)} @app.post("/uploadfile/") async def create_upload_file( file: Annotated[UploadFile, File(description="A file read as UploadFile")], ):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Mar 18 12:29:59 UTC 2023 - 431 bytes - Viewed (0) -
docs_src/separate_openapi_schemas/tutorial001_py310.py
from pydantic import BaseModel class Item(BaseModel): name: str description: str | None = None app = FastAPI() @app.post("/items/") def create_item(item: Item): return item @app.get("/items/") def read_items() -> list[Item]: return [ Item( name="Portal Gun", description="Device to travel through the multi-rick-verse", ),
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 25 19:10:22 UTC 2023 - 451 bytes - Viewed (0) -
docs_src/websockets/tutorial002_an.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[Union[str, None], Cookie()] = None, token: Annotated[Union[str, None], Query()] = 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_an_py39.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[Union[str, None], Cookie()] = None, token: Annotated[Union[str, None], Query()] = 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) -
tests/test_tutorial/test_response_model/test_tutorial003_py310.py
from fastapi.testclient import TestClient from ...utils import needs_py310 @pytest.fixture(name="client") def get_client(): from docs_src.response_model.tutorial003_py310 import app client = TestClient(app) return client @needs_py310 def test_post_user(client: TestClient): response = client.post( "/user/", json={ "username": "foo",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Aug 04 20:47:07 UTC 2023 - 5.8K bytes - Viewed (0) -
tests/test_tutorial/test_dependencies/test_tutorial004_an_py310.py
200, {"items": [{"item_name": "Bar"}], "q": "bar"}, ), ], ) def test_get(path, expected_status, expected_response, client: TestClient): response = client.get(path) assert response.status_code == expected_status assert response.json() == expected_response @needs_py310 def test_openapi_schema(client: TestClient): response = client.get("/openapi.json")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jul 07 17:12:13 UTC 2023 - 5.6K bytes - Viewed (0) -
tests/test_webhooks_security.py
@app.webhooks.post("new-subscription") def new_subscription( body: Subscription, token: Annotated[str, Security(bearer_scheme)] ): """ When a new user subscribes to your service we'll send you a POST request with this data to the URL that you register for the event `new-subscription` in the dashboard. """ client = TestClient(app) def test_dummy_webhook(): # Just for coverage
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Oct 20 09:00:44 UTC 2023 - 4.6K bytes - Viewed (0)