1
0
mirror of https://github.com/home-assistant/core.git synced 2026-06-03 06:04:06 +01:00
Files
2026-05-14 23:16:47 +02:00

23 lines
625 B
Python

"""HTTP client for fetching remote calendar data."""
from httpx import AsyncClient, Auth, BasicAuth, Response, Timeout
async def get_calendar(
client: AsyncClient,
url: str,
username: str | None = None,
password: str | None = None,
) -> Response:
"""Make an HTTP GET request using Home Assistant's async HTTPX client."""
auth: Auth | None = None
if username is not None and password is not None:
auth = BasicAuth(username, password)
return await client.get(
url,
auth=auth,
follow_redirects=True,
timeout=Timeout(5, read=30, write=5, pool=5),
)