Skip to content

Allow callers to provide an HTTPX client - #18

Open
2tefan wants to merge 1 commit into
home-assistant-ecosystem:masterfrom
2tefan:allow-passing-of-httpx-client
Open

2tefan wants to merge 1 commit into
home-assistant-ecosystem:masterfrom
2tefan:allow-passing-of-httpx-client

Conversation

@2tefan

@2tefan 2tefan commented Sep 13, 2026

Copy link
Copy Markdown

Hi,

Currently a new client is created for every new request:

try:
async with httpx.AsyncClient() as client:
response = await client.get(str(url))

This PR allows callers to pass their own session. This allows it to be reused and also will help fix a home assistant issue. I'll open another PR there once this is added.
Related to home-assistant/core#173879

Existing behavior is preserved when no client is provided.
Please let me know if you want any changes :)

Allows Home Assistant and others to pass a shared client instead of creating a new client for every request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant