Correction for https://github.com/home-assistant/core/issues/125260 via an injection of httpx_client from homeassistant #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi @fabaff ,
I propose you this small evolution in order to resolve the issue home-assistant/core#125260 in homeassistant that detects event_loop warning in used API for ssl context object (cf : https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs).
After digging how other integrations use httpx library, I found that the injection of the client from the core is the correct way of doing it.
It works well in latest homeassistant core on my pc.
After, you release the 1.3.0 version of netdata library, the small correction in homeassistant will be to upgrade netdata dependency and to inject the client via this line of code :
netdata = NetdataData(Netdata(host, port=port, timeout=20.0, httpx_client=get_async_client(hass)))
I can do the PR on homeassistant core if you want.
If ou have any question, do not hesitate to ask me.