from apollo_utils.job.clients.base.client import BaseApiClient from src.clients.base_config import ApiConfig from src.constants import ATLAS_AUDIENCE, ATLAS_GRANT_TYPE, Service class AtlasAuthClientConfig(ApiConfig): _loaded_attrs = ("host", "client_secret", "client_id") service = Service.ATLAS class AtlasAuthClient(AtlasAuthClientConfig, BaseApiClient): _client_id = None _client_secret = None def _get_header(self): return {} def get_access_token(self): result = self.send_request( "oauth/token", method="POST", data={ "audience": ATLAS_AUDIENCE, "grant_type": ATLAS_GRANT_TYPE, "client_id": self._client_id, "client_secret": self._client_secret, }, get_json=True, ) return result["access_token"]