- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 125 for Try (0.15 sec)
-
docs_src/dependencies/tutorial008_an.py
from fastapi import Depends from typing_extensions import Annotated async def dependency_a(): dep_a = generate_dep_a() try: yield dep_a finally: dep_a.close() async def dependency_b(dep_a: Annotated[DepA, Depends(dependency_a)]): dep_b = generate_dep_b() try: yield dep_b finally: dep_b.close(dep_a)
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 531 bytes - Viewed (0) -
docs_src/dependencies/tutorial008c_an_py39.py
from typing import Annotated from fastapi import Depends, FastAPI, HTTPException app = FastAPI() class InternalError(Exception): pass def get_username(): try: yield "Rick" 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":
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 700 bytes - Viewed (0) -
scripts/playwright/separate_openapi_schemas/image01.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Aug 25 19:10:22 GMT 2023 - 819 bytes - Viewed (0) -
docs_src/sql_databases/sql_app/tests/test_sql_app.py
poolclass=StaticPool, ) TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) Base.metadata.create_all(bind=engine) def override_get_db(): try: db = TestingSessionLocal() yield db finally: db.close() app.dependency_overrides[get_db] = override_get_db client = TestClient(app) def test_create_user():
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Jun 22 11:20:12 GMT 2023 - 1.2K bytes - Viewed (0) -
docs_src/sql_databases/sql_app_py310/main.py
from . import crud, models, schemas from .database import SessionLocal, engine models.Base.metadata.create_all(bind=engine) app = FastAPI() # Dependency def get_db(): db = SessionLocal() try: yield db finally: db.close() @app.post("/users/", response_model=schemas.User) def create_user(user: schemas.UserCreate, db: Session = Depends(get_db)):
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Jan 07 14:11:31 GMT 2022 - 1.6K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
``` !!! tip You can use `async` or regular functions. **FastAPI** will do the right thing with each, the same as with normal dependencies. ## A dependency with `yield` and `try` If you use a `try` block in a dependency with `yield`, you'll receive any exception that was thrown when using the dependency.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 14.1K bytes - Viewed (0) -
docs/en/docs/tutorial/sql-databases.md
It could have a value like `"Arquilian"`. And the ORM will do all the work to get the information from the corresponding table *owners* when you try to access it from your pet object. Common ORMs are for example: Django-ORM (part of the Django framework), SQLAlchemy ORM (part of SQLAlchemy, independent of framework) and Peewee (independent of framework), among others.
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 29.6K bytes - Viewed (0) -
docs/en/data/sponsors.yml
gold: - url: https://cryptapi.io/ title: "CryptAPI: Your easy to use, secure and privacy oriented payment gateway." img: https://fastapi.tiangolo.com/img/sponsors/cryptapi.svg - url: https://platform.sh/try-it-now/?utm_source=fastapi-signup&utm_medium=banner&utm_campaign=FastAPI-signup-June-2023 title: "Build, run and scale your apps on a modern, reliable, and secure PaaS." img: https://fastapi.tiangolo.com/img/sponsors/platform-sh.png
Others - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Mon Mar 25 23:10:11 GMT 2024 - 3.3K bytes - Viewed (0) -
docs_src/security/tutorial004_py310.py
credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", headers={"WWW-Authenticate": "Bearer"}, ) try: payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM]) username: str = payload.get("sub") if username is None: raise credentials_exception
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Mar 26 16:56:53 GMT 2024 - 4K bytes - Viewed (0) -
fastapi/dependencies/utils.py
def check_file_field(field: ModelField) -> None: field_info = field.field_info if isinstance(field_info, params.Form): try: # __version__ is available in both multiparts, and can be mocked from multipart import __version__ # type: ignore assert __version__ try: # parse_options_header is only available in the right multipart
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Apr 02 02:52:56 GMT 2024 - 29.5K bytes - Viewed (0)