- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 140 for raise (0.02 sec)
-
tests/test_dependency_contextmanager.py
assert state["/async_raise"] == "asyncgen raise not started" with pytest.raises(OtherDependencyError): client.get("/async_raise_other") assert state["/async_raise"] == "asyncgen raise finalized" assert "/async_raise" not in errors def test_sync_raise_other(): assert state["/sync_raise"] == "generator raise not started" with pytest.raises(OtherDependencyError):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Aug 17 04:13:50 UTC 2024 - 11.6K bytes - Viewed (0) -
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
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 14K bytes - Viewed (0) -
docs_src/app_testing/app_b_an_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: Annotated[str, Header()]): if x_token != fake_secret_token:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Aug 15 22:31:16 UTC 2024 - 1.1K bytes - Viewed (0) -
docs_src/security/tutorial005_an_py310.py
if username is None: raise credentials_exception token_scopes = payload.get("scopes", []) token_data = TokenData(scopes=token_scopes, username=username) except (InvalidTokenError, ValidationError): raise credentials_exception user = get_user(fake_users_db, username=token_data.username) if user is None: raise credentials_exception
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.2K bytes - Viewed (0) -
docs_src/security/tutorial005_an_py39.py
if username is None: raise credentials_exception token_scopes = payload.get("scopes", []) token_data = TokenData(scopes=token_scopes, username=username) except (InvalidTokenError, ValidationError): raise credentials_exception user = get_user(fake_users_db, username=token_data.username) if user is None: raise credentials_exception
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.3K bytes - Viewed (0) -
docs/em/docs/tutorial/dependencies/dependencies-with-yield.md
Note over client,tasks: Can raise exception for dependency, handled after response is sent Note over client,operation: Can raise HTTPException and can change the response client ->> dep: Start request Note over dep: Run code up to yield opt raise dep -->> handler: Raise HTTPException handler -->> client: HTTP error response dep -->> dep: Raise other exception end
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 8.6K bytes - Viewed (0) -
docs_src/security/tutorial004.py
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.1K bytes - Viewed (0) -
docs_src/security/tutorial004_an_py310.py
username: str = payload.get("sub") if username is None: raise credentials_exception token_data = TokenData(username=username) except InvalidTokenError: raise credentials_exception user = get_user(fake_users_db, username=token_data.username) if user is None: raise credentials_exception return user async def get_current_active_user(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 4.1K bytes - Viewed (0) -
docs_src/dependencies/tutorial008c.py
except InternalError: print("Oops, we didn't raise again, Britney 😱") @app.get("/items/{item_id}") def get_item(item_id: str, username: 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(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 660 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(
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 700 bytes - Viewed (0)