mirror of
https://github.com/home-assistant/core.git
synced 2025-11-11 03:50:55 +00:00
Bump httpx to 0.17.1 (#48388)
* Bump httpx to 0.17.1 * git add * typing * add test * tweak
This commit is contained in:
@@ -39,6 +39,17 @@ def get_async_client(
|
||||
return client
|
||||
|
||||
|
||||
class HassHttpXAsyncClient(httpx.AsyncClient):
|
||||
"""httpx AsyncClient that suppresses context management."""
|
||||
|
||||
async def __aenter__(self: HassHttpXAsyncClient) -> HassHttpXAsyncClient:
|
||||
"""Prevent an integration from reopen of the client via context manager."""
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any) -> None: # pylint: disable=signature-differs
|
||||
"""Prevent an integration from close of the client via context manager."""
|
||||
|
||||
|
||||
@callback
|
||||
def create_async_httpx_client(
|
||||
hass: HomeAssistantType,
|
||||
@@ -53,7 +64,7 @@ def create_async_httpx_client(
|
||||
|
||||
This method must be run in the event loop.
|
||||
"""
|
||||
client = httpx.AsyncClient(
|
||||
client = HassHttpXAsyncClient(
|
||||
verify=verify_ssl,
|
||||
headers={USER_AGENT: SERVER_SOFTWARE},
|
||||
**kwargs,
|
||||
|
||||
Reference in New Issue
Block a user