- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 212 for raise (0.15 sec)
-
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
Note over client,operation: Can raise exceptions, including HTTPException client ->> dep: Start request Note over dep: Run code up to yield opt raise Exception dep -->> handler: Raise Exception handler -->> client: HTTP error response end dep ->> operation: Run dependency, e.g. DB session opt raise operation -->> dep: Raise Exception (e.g. HTTPException) opt handle
Plain Text - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 14.1K bytes - Viewed (0) -
tests/test_dependency_contextmanager.py
client.get("/sync_raise_other") assert state["/sync_raise"] == "generator raise finalized" assert "/sync_raise" not in errors def test_async_raise_raises(): with pytest.raises(AsyncDependencyError): client.get("/async_raise") assert state["/async_raise"] == "asyncgen raise finalized" assert "/async_raise" in errors errors.clear() def test_async_raise_server_error():
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 11.6K bytes - Viewed (0) -
docs_src/app_testing/app_b_py310/main.py
if x_token != fake_secret_token: raise HTTPException(status_code=400, detail="Invalid X-Token header") if item_id not in fake_db: raise HTTPException(status_code=404, detail="Item not found") return fake_db[item_id] @app.post("/items/", response_model=Item) async def create_item(item: Item, x_token: str = Header()): if x_token != fake_secret_token:
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Jan 09 14:44:08 GMT 2024 - 1.1K bytes - Viewed (0) -
docs_src/app_testing/app_b_an/main.py
if x_token != fake_secret_token: raise HTTPException(status_code=400, detail="Invalid X-Token header") if item_id not in fake_db: raise HTTPException(status_code=404, detail="Item not found") return fake_db[item_id] @app.post("/items/", response_model=Item) async def create_item(item: Item, x_token: Annotated[str, Header()]): if x_token != fake_secret_token:
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 1.2K bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_an_py39.py
except InternalError: print("Oops, we didn't raise again, Britney 😱") @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id == "portal-gun": raise InternalError( f"The portal gun is too dangerous to be owned by {username}" ) if item_id != "plumbus": raise HTTPException(
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 700 bytes - Viewed (0) -
docs/en/docs/tutorial/handling-errors.md
Plain Text - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.1K bytes - Viewed (0) -
docs_src/security/tutorial004_py310.py
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Mar 26 16:56:53 GMT 2024 - 4K bytes - Viewed (0) -
tests/test_serialize_response_dataclass.py
def test_valid(): response = client.get("/items/valid") response.raise_for_status() assert response.json() == { "name": "valid", "date": datetime(2021, 7, 26).isoformat(), "price": 1.0, "owner_ids": None, } def test_object(): response = client.get("/items/object") response.raise_for_status() assert response.json() == { "name": "object",
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Fri Aug 26 13:56:47 GMT 2022 - 4.9K bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_an.py
except InternalError: print("Oops, we didn't raise again, Britney 😱") @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id == "portal-gun": raise InternalError( f"The portal gun is too dangerous to be owned by {username}" ) if item_id != "plumbus": raise HTTPException(
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 710 bytes - Viewed (0) -
docs_src/dependencies/tutorial008b_an_py39.py
except OwnerError as e: raise HTTPException(status_code=400, detail=f"Owner error: {e}") @app.get("/items/{item_id}") def get_item(item_id: str, username: Annotated[str, Depends(get_username)]): if item_id not in data: raise HTTPException(status_code=404, detail="Item not found") item = data[item_id] if item["owner"] != username: raise OwnerError(username)
Python - Registered: Sun Apr 21 07:19:11 GMT 2024 - Last Modified: Tue Dec 26 20:37:34 GMT 2023 - 775 bytes - Viewed (0)