from automapa_map_services.client import ApiClient from automapa_map_services.config import Config from automapa_map_services.http.urllib_client import UrllibHttpClient from automapa_map_services.session.manager import SessionManager class SuppliedSession: def __init__(self, session_id: str): self.session_id = session_id def get(self) -> str: if not self.session_id: raise RuntimeError("SESSION_REQUIRED") return self.session_id def store(self, session_id: str) -> None: self.session_id = session_id def clear(self) -> None: self.session_id = "" def build_client(session_id: str, http_client=None) -> ApiClient: storage = SuppliedSession(session_id) storage.get() config = Config(key="", password="", base_url="https://api.automapa.com/") http = http_client if http_client is not None else UrllibHttpClient() return ApiClient(config, http, SessionManager(config, http, storage))