Module sktmls.apis.profile_api
Classes
class MLSProfileAPIClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, client_id: str = None, apikey: str = None)
-
MLS 프로파일 API를 호출할 수 있는 클라이언트입니다.
MMS를 제외한 환경에서는 테스트용 호출로 처리됩니다.
EDD 환경은 지원하지 않습니다.
Args
- env: (
MLSENV
) 접근할 MLS 환경 (MLSENV.DEV
|MLSENV.STG
|MLSENV.PRD
) (기본값:MLSENV.STG
) - runtime_env: (
MLSRuntimeENV
) 클라이언트가 실행되는 환경 (MLSRuntimeENV.YE
|MLSRuntimeENV.MMS
|MLSRuntimeENV.LOCAL
) (기본값:MLSRuntimeENV.LOCAL
) - client_id: (optional) (str) 호출 클라이언트 (
tw
,twd
,netcrm
등) - apikey: (optional) (str) 클라이언트의 API Key
아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.
- $MLS_ENV: env
- $AWS_ENV: env
- $MLS_RUNTIME_ENV: runtime_env
runtime_env가
MLSRuntimeENV.MMS
인 경우client_id
와apikey
파라미터를 생략 가능합니다.Returns
Example
profile_api_client = MLSProfileAPIClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE)
Methods
def get_env(self) ‑> MLSENV
def get_item_profile(self, profile_id: str, item_id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS Item Profile API를 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- item_id: (str) 아이템 고유 ID
- keys: (optional) (list(str)) 조회할 키 리스트 (기본값: None, 기본값 전달시 모든 키 조회)
Returns
dict
Example
item_profile_dict = profile_api_client.get_item_profile( profile_id="device", item_id="item001", keys=["price", "resolution"] )
async def get_item_profile_async(self, profile_id: str, item_id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS Item Profile API를 비동기로 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- item_id: (str) 아이템 고유 ID
- keys: (optional) (list(str)) 조회할 키 리스트 (기본값: None, 기본값 전달시 모든 키 조회)
Returns
dict
Example
item_profile_dict = await profile_api_client.get_item_profile_async( profile_id="device", item_id="item001", keys=["price", "resolution"] )
def get_profile(self, profile_id: str, id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS 통합 Profile API를 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- id: (str) 조회할 ID
Returns
dict
Example
profile_dict = profile_api_client.get_profile( profile_id="default", target_id="001", keys=["age", "gender"] )
async def get_profile_async(self, profile_id: str, id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS 통합 Profile API를 비동기로 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- id: (str) 조회할 ID
Returns
dict
Example
profile_dict = await profile_api_client.get_profile_async( profile_id="default", target_id="001", keys=["age", "gender"] )
def get_runtime_env(self) ‑> MLSRuntimeENV
def get_user_profile(self, profile_id: str, user_id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS User Profile API를 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- user_id: (str) 해시된 유저 고유 ID (해시된 서비스관리번호)
- keys: (optional) (list(str)) 조회할 키 리스트 (기본값: None, 기본값 전달시 모든 키 조회)
Returns
dict
Example
user_profile_dict = profile_api_client.get_user_profile( profile_id="default", user_id=hashlib.sha256("1234567890".encode()).hexdigest(), keys=["age", "gender"] )
async def get_user_profile_async(self, profile_id: str, user_id: str, keys: List[str] = None) ‑> Dict[str, Any]
-
MLS User Profile API를 비동기로 호출합니다.
Args
- profile_id: (str) 호출할 프로파일 ID
- user_id: (str) 해시된 유저 고유 ID (해시된 서비스관리번호)
- keys: (optional) (list(str)) 조회할 키 리스트 (기본값: None, 기본값 전달시 모든 키 조회)
Returns
dict
Example
user_profile_dict = await profile_api_client.get_user_profile_async( profile_id="default", user_id=hashlib.sha256("1234567890".encode()).hexdigest(), keys=["age", "gender"] )
- env: (