Debian Codegraph @

yolink/auth_mgr.py

raw symbols SCIP
1 """YoLink authorization manager."""
2
3 import abc
4 from aiohttp import ClientSession
5
6
7 class YoLinkAuthMgr(metaclass=abc.ABCMeta):
8 """YoLink API Authentication Manager."""
9
10 def __init__(self, session: ClientSession) -> None:
11 """YoLink Auth Manager"""
12 self._session = session
13
14 def client_session(self) -> ClientSession:
15 """Get client session."""
16 return self._session
17
18 @abc.abstractmethod
19 def access_token(self) -> str:
20 """Get auth token."""
21
22 def http_auth_header(self) -> str:
23 """Get auth header."""
24 return f"Bearer {self.access_token()}"
25
26 @abc.abstractmethod
27 async def check_and_refresh_token(self) -> str:
28 """Check and fresh token."""