python-casahome 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
casahome/__init__.py ADDED
@@ -0,0 +1,30 @@
1
+ """Unofficial async client for the Casa (getcasa.com) member API."""
2
+
3
+ from .api import CasaApi, is_unverified
4
+ from .auth import FirebaseAuth, TokenResponse
5
+ from .client import CasaClient
6
+ from .exceptions import (
7
+ CasaApiError,
8
+ CasaAuthError,
9
+ CasaConnectionError,
10
+ CasaError,
11
+ CasaRequestError,
12
+ CasaResponseError,
13
+ )
14
+
15
+ __version__ = "0.2.0"
16
+
17
+ __all__ = [
18
+ "CasaApi",
19
+ "CasaApiError",
20
+ "CasaAuthError",
21
+ "CasaClient",
22
+ "CasaConnectionError",
23
+ "CasaError",
24
+ "CasaRequestError",
25
+ "CasaResponseError",
26
+ "FirebaseAuth",
27
+ "TokenResponse",
28
+ "__version__",
29
+ "is_unverified",
30
+ ]
casahome/_base_http.py ADDED
@@ -0,0 +1,21 @@
1
+ """Small shared HTTP helpers."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from collections.abc import AsyncIterator
6
+ from contextlib import asynccontextmanager
7
+
8
+ import aiohttp
9
+
10
+ from .exceptions import CasaConnectionError
11
+
12
+
13
+ @asynccontextmanager
14
+ async def wrap_connection_errors() -> AsyncIterator[None]:
15
+ """Translate aiohttp network failures and timeouts into CasaConnectionError."""
16
+ try:
17
+ yield
18
+ except TimeoutError as err:
19
+ raise CasaConnectionError("Request timed out") from err
20
+ except aiohttp.ClientError as err:
21
+ raise CasaConnectionError(str(err) or type(err).__name__) from err