defget_items(self,entity: str) -> List[Item]: resp = requests.get(self.construct_url(entity)) resp.raise_for_status() return [Item(**n) for n in resp.json()["items"]]
defsave_items(self, entity: str) -> None: with scoped_session(self.session_cls)as session: session.add(self.get_items(entity))
class ClientA(ApiClient): defconstruct_url(self, entity: str) -> str: returnf"{self.root_url}/{entity}"
class ClientB(ApiClient): defconstruct_url(self, entity: str) -> str: returnf"{self.root_url}/a/special/place/{entity}"