-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: httpx client & handler & router
- Loading branch information
Showing
6 changed files
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .health import * | ||
|
||
__all__ = [ | ||
"health_router", | ||
"basic_router", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .liveness_probe import router as health_router | ||
from .liveness_probe import basic_router | ||
|
||
__all__ = [ | ||
"health_router", | ||
"basic_router", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .httpx import get_async_http_session | ||
from .postgres import AsyncPostgresClient | ||
|
||
__all__ = ["AsyncPostgresClient"] | ||
__all__ = ["AsyncPostgresClient", "get_async_http_session"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# Purpose: Provide an example of an async http client for the application | ||
import contextlib | ||
import typing | ||
|
||
import httpx | ||
|
||
|
||
@contextlib.asynccontextmanager | ||
async def get_http_client() -> typing.AsyncGenerator[httpx.AsyncClient, None]: | ||
client = httpx.AsyncClient() # Insert your own settings here | ||
async def get_async_http_session( | ||
settings: dict[str, typing.Any] | None = None | ||
) -> typing.AsyncGenerator[httpx.AsyncClient, None]: | ||
"""Async http client.""" | ||
if settings is None: | ||
settings = {} | ||
client = httpx.AsyncClient(**settings) # Insert your own settings here | ||
async with client as ac: | ||
yield ac |