- Sort Score
- Result 10 results
- Languages All
Results 101 - 110 of 1,379 for def2 (0.02 sec)
-
tests/test_tutorial/test_dependencies/test_tutorial008c.py
def test_get(client: TestClient): response = client.get("/items/plumbus") assert response.status_code == 200, response.text assert response.json() == "plumbus" def test_fastapi_error(client: TestClient): with pytest.raises(FastAPIError) as exc_info: client.get("/items/portal-gun") assert "No response object was returned" in exc_info.value.args[0] def test_internal_server_error():
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sat Feb 24 23:06:37 UTC 2024 - 1.1K bytes - Viewed (0) -
tests/test_forms_single_model.py
age: Optional[int] = None tags: List[str] = ["foo", "bar"] alias_with: str = Field(alias="with", default="nothing") @app.post("/form/") def post_form(user: Annotated[FormModel, Form()]): return user client = TestClient(app) def test_send_all_data(): response = client.post( "/form/", data={ "username": "Rick", "lastname": "Sanchez",
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Sep 13 09:51:00 UTC 2024 - 3.5K bytes - Viewed (0) -
docs/tr/docs/async.md
Aynısı bağımlılıklar için de geçerlidir. Bir bağımlılık, "async def" yerine standart bir "def" işleviyse, harici iş parçacığı havuzunda çalıştırılır. ### Alt-bağımlıklar
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Tue Aug 06 04:48:30 UTC 2024 - 21.9K bytes - Viewed (0) -
docs_src/security/tutorial005_py39.py
) app = FastAPI() def verify_password(plain_password, hashed_password): return pwd_context.verify(plain_password, hashed_password) def get_password_hash(password): return pwd_context.hash(password) def get_user(db, username: str): if username in db: user_dict = db[username] return UserInDB(**user_dict) def authenticate_user(fake_db, username: str, password: str):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Mon May 20 17:37:28 UTC 2024 - 5.2K bytes - Viewed (0) -
tests/test_dependency_class.py
class CallableDependency: def __call__(self, value: str) -> str: return value class CallableGenDependency: def __call__(self, value: str) -> Generator[str, None, None]: yield value class AsyncCallableDependency: async def __call__(self, value: str) -> str: return value class AsyncCallableGenDependency:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Aug 09 10:54:05 UTC 2020 - 3.3K bytes - Viewed (0) -
tests/test_security_http_base.py
app = FastAPI() security = HTTPBase(scheme="Other") @app.get("/users/me") def read_current_user(credentials: HTTPAuthorizationCredentials = Security(security)): return {"scheme": credentials.scheme, "credentials": credentials.credentials} client = TestClient(app) def test_security_http_base(): response = client.get("/users/me", headers={"Authorization": "Other foobar"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.7K bytes - Viewed (0) -
tests/test_security_api_key_cookie.py
api_key = APIKeyCookie(name="key") class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): return current_user def test_security_api_key(): client = TestClient(app, cookies={"key": "secret"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 1.9K bytes - Viewed (0) -
tests/test_security_api_key_cookie_description.py
class User(BaseModel): username: str def get_current_user(oauth_header: str = Security(api_key)): user = User(username=oauth_header) return user @app.get("/users/me") def read_current_user(current_user: User = Depends(get_current_user)): return current_user def test_security_api_key(): client = TestClient(app, cookies={"key": "secret"})
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Jun 30 18:25:16 UTC 2023 - 2.1K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002_an_py39.py
engine = create_engine(sqlite_url, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session: yield session SessionDep = Annotated[Session, Depends(get_session)] app = FastAPI() @app.on_event("startup") def on_startup(): create_db_and_tables()
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.5K bytes - Viewed (0) -
docs_src/sql_databases/tutorial001_an.py
engine = create_engine(sqlite_url, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session: yield session SessionDep = Annotated[Session, Depends(get_session)] app = FastAPI() @app.on_event("startup") def on_startup(): create_db_and_tables() @app.post("/heroes/")
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 1.8K bytes - Viewed (0)