Module sktmls.apis.conversion_tracking_api
Classes
class MLSConversionTrackingAPIClient (client_id: str, apikey: str, env: MLSENV = None, runtime_env: MLSRuntimeENV = None)
-
MLS Conversion Tracking API를 호출할 수 있는 클라이언트입니다.
모든 호출은 테스트용 호출로 처리됩니다.
MMS, EDD 환경은 지원하지 않습니다.
Args
- client_id: (str) 호출 클라이언트 (
tw
,twd
,netcrm
등) - apikey: (str) 클라이언트의 API Key
- env: (
MLSENV
) 접근할 MLS 환경 (MLSENV.DEV
|MLSENV.STG
|MLSENV.PRD
) (기본값:MLSENV.STG
) - runtime_env: (
MLSRuntimeENV
) 클라이언트가 실행되는 환경 (MLSRuntimeENV.YE
|MLSRuntimeENV.LOCAL
) (기본값:MLSRuntimeENV.LOCAL
)
아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.
- $MLS_ENV: env
- $AWS_ENV: env
- $MLS_RUNTIME_ENV: runtime_env
Returns
MLSConversionTrackingAPIClient
Example
conversion_tracking_api_client = MLSConversionTrackingAPIClient(client_id="tw", apikey="test_apikey", env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE)
Methods
def get_env(self) ‑> MLSENV
def get_runtime_env(self) ‑> MLSRuntimeENV
def request(self, user_id: str, channel_id: str, conversion_type: str, process_id: str, item_id: str) ‑> Dict[str, Any]
-
MLS Conversion Tracking API를 호출합니다.
Args
- user_id: (str) 추천 요청의 user ID (해시된 서비스관리번호)
- channel_id: (str) 추천 요청 또는 응답의 channel ID
- conversion_type: (str) 이벤트 타입(
impression
|click
|detail_view
|like
|dislike
) - process_id: (str) 추천 결과 응답의 process ID
- item_id : (str) 추천 결과 응답의 item_id
Returns
dict
Example
conversion_tracking_dict = conversion_tracking_api_client.request( user_id=hashlib.sha256("1234567890".encode()).hexdigest(), channel_id="sample_channel", conversion_type="impression", process_id="sample_process", item_id="sample_item", )
async def request_async(self, user_id: str, channel_id: str, conversion_type: str, process_id: str, item_id: str) ‑> Dict[str, Any]
-
MLS Conversion Tracking API를 비동기 호출합니다.
Args
- user_id: (str) 추천 요청의 user ID (해시된 서비스관리번호)
- channel_id: (str) 추천 요청 또는 응답의 channel ID
- conversion_type: (str) 이벤트 타입(
impression
|click
|detail_view
|like
|dislike
) - process_id: (str) 추천 결과 응답의 process ID
- item_id : (str) 추천 결과 응답의 item_id
Returns
dict
Example
conversion_tracking_dict = await conversion_tracking_api_client.request_async( user_id=hashlib.sha256("1234567890".encode()).hexdigest(), channel_id="sample_channel", conversion_type="impression", process_id="sample_process", item_id="sample_item", )
- client_id: (str) 호출 클라이언트 (