1 """Subscription information."""
3 from __future__
import annotations
9 from aiohttp.client_exceptions
import ClientError
10 from hass_nabucasa
import Cloud, cloud_api
12 from .client
import CloudClient
13 from .const
import REQUEST_TIMEOUT
15 _LOGGER = logging.getLogger(__name__)
19 """Fetch the subscription info."""
21 async
with asyncio.timeout(REQUEST_TIMEOUT):
22 return await cloud_api.async_subscription_info(cloud)
26 "A timeout of %s was reached while trying to fetch subscription"
32 _LOGGER.error(
"Failed to fetch subscription information")
38 cloud: Cloud[CloudClient],
39 ) -> dict[str, Any] |
None:
40 """Migrate a paypal agreement from legacy."""
42 async
with asyncio.timeout(REQUEST_TIMEOUT):
43 return await cloud_api.async_migrate_paypal_agreement(cloud)
46 "A timeout of %s was reached while trying to start agreement migration",
49 except ClientError
as exception:
50 _LOGGER.error(
"Failed to start agreement migration - %s", exception)
dict[str, Any]|None async_migrate_paypal_agreement(Cloud[CloudClient] cloud)
dict[str, Any]|None async_subscription_info(Cloud[CloudClient] cloud)