Bump httpx to 0.17.1 (#48388)
* Bump httpx to 0.17.1 * git add * typing * add test * tweak
This commit is contained in:
parent
b50dcef94f
commit
79af18a8ab
5 changed files with 28 additions and 4 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue