from apollo_utils.job.clients.base.client import BaseApiClient from juno_email_messages import config from juno_email_messages.clients.base_config import ApiConfig from juno_email_messages.constants import Service class AtlasClientConfig(ApiConfig): service = Service.ATLAS _loaded_attrs = (("hostname", "host"), ("clientsecret", "client_secret"), ("clientid", "client_id")) class AtlasClient(AtlasClientConfig, 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": config.ATLAS_AUDIENCE, "grant_type": config.ATLAS_GRANT_TYPE, "client_id": self._client_id, "client_secret": self._client_secret, }, get_json=True, ) return result["access_token"]