Module sktmls.filters

Sub-modules

sktmls.filters.filter

Classes

class Filter (**kwargs)

MLS 필터 클래스입니다.

Args

  • kwargs
    • id: (int) 필터 고유 ID
    • name: (str) 필터 이름
    • conditions: (list(dict)) 필터 조건 리스트
    • created_at: (datetime) 생성일시
    • updated_at: (datetime) 수정일시

Returns

Filter

Methods

def get(self)
def reset(self, **kwargs)
class FilterClient (env: MLSENV = None, runtime_env: MLSRuntimeENV = None, username: str = None, password: str = None)

MLS 필터 관련 기능들을 제공하는 클라이언트입니다.

Args

아래의 환경 변수가 정의된 경우 해당 파라미터를 생략 가능합니다.

  • $MLS_ENV: env
  • $MLS_RUNTIME_ENV: runtime_env
  • $MLS_USERNAME: username
  • $MLS_PASSWORD: password

Returns

FilterClient

Example

filter_client = FilterClient(env=MLSENV.STG, runtime_env=MLSRuntimeENV.YE, username="mls_account", password="mls_password")

Ancestors

Methods

def create_filter(self, name: str, conditions: List[Dict]) ‑> Filter

필터를 생성합니다.

Args

  • name: (str) 필터 이름
  • conditions: (list(dict)) 필터 조건 리스트
    • key: 프로파일 키
    • operator: 연산자 (==|!=|<=|>=|<|>|contains)
    • value: 비교할 값

Returns

Filter

  • id: (int) 필터 고유 ID
  • name: (str) 필터 이름
  • conditions: (list(dict)) 필터 조건 리스트
  • created_at: (datetime) 생성일시
  • updated_at: (datetime) 수정일시

Example

filter = filter_client.create_filter(
    name="hello",
    conditions=[
        {"key": "age", "operator": "<", "value": "19"},
        {"key": "gender", "operator": "==", "value": "F"},
    ]
)
def delete_filter(self, filter: Filter) ‑> MLSResponse

필터 삭제합니다.

Args

  • filter: (Filter) 필터 객체

Returns

MLSResponse

Example

filter_client.delete_filter(filter)
def get_filter(self, type: str = None, id: int = None, name: str = None) ‑> Filter

필터 정보를 가져옵니다.

Args: id 또는 name 중 한 개 이상의 값이 반드시 전달되어야 합니다.

  • id: (optional) (int) 필터 고유 ID
  • name: (optional) (str) 필터 이름

Returns

Filter

  • id: (int) 필터 고유 ID
  • name: (str) 필터 이름
  • conditions: (list(dict)) 필터 조건 리스트
  • created_at: (datetime) 생성일시
  • updated_at: (datetime) 수정일시

Example

filter_by_id = filter_client.get_filter(id=3)
filter_by_name = filter_client.get_filter(name="hello")
def list_filters(self, **kwargs) ‑> List[Filter]

필터 리스트를 가져옵니다. (필터 조건 제외)

Args

  • kwargs: (optional) (dict) 쿼리 조건
    • id: (int) 필터 고유 ID
    • name: (str) 필터 이름
    • query: (str) 검색 문자
    • page: (int) 페이지 번호

Returns

list(Filter)

  • id: (int) 필터 고유 ID
  • name: (str) 필터 이름
  • created_at: (datetime) 생성일시
  • updated_at: (datetime) 수정일시

Example

filters = filter_client.list_filters()
def update_filter(self, filter: Filter, name: str = None, conditions: List[Dict] = None) ‑> Filter

필터 정보를 수정합니다.

Args

  • filter: (Filter) 필터 객체
  • name: (str) 필터 이름
  • conditions: (list(dict)) 필터 조건 리스트
    • key: 프로파일 키
    • operator: 연산자 (==|!=|<=|>=|<|>|contains)
    • value: 비교할 값

Returns

Filter

  • id: (int) 필터 고유 ID
  • name: (str) 필터 이름
  • conditions: (list(dict)) 필터 조건 리스트
  • created_at: (datetime) 생성일시
  • updated_at: (datetime) 수정일시

Example

filter = filter_clinet.get_filter(name="hello")
filter = filter_client.update_filter(
    filter=filter,
    name="bye",
    conditions=[
        {"key": "age", "operator": "<", "value": "50"},,
        {"key": "gender", "operator": "==", "value": "M"},
    ]
)