콘텐츠로 이동

EcosClient

한국은행 ECOS Open API와 직접 통신하는 저수준 클라이언트 클래스입니다.

EcosClient

ECOS API 클라이언트

한국은행 ECOS Open API와 HTTP 통신을 담당합니다.

Parameters:

Name Type Description Default
api_key str

ECOS API 인증키. 미제공 시 환경 변수에서 로드

None
timeout int

요청 타임아웃(초), 기본값 30

DEFAULT_TIMEOUT
max_retries int

최대 재시도 횟수, 기본값 3

MAX_RETRIES
use_cache bool

캐시 사용 여부, 기본값 True

True

Examples:

>>> client = EcosClient()
>>> result = client.get_statistic_search(
...     stat_code="722Y001",
...     period="M",
...     start_date="202301",
...     end_date="202312",
...     item_code1="0101000"
... )
get_statistic_search(stat_code: str, period: str, start_date: str, end_date: str, item_code1: str = '', item_code2: str = '', item_code3: str = '', item_code4: str = '', start: int = 1, end: int = 100000) -> dict[str, Any]

통계 조회 (StatisticSearch)

Parameters:

Name Type Description Default
stat_code str

통계표코드

required
period str

주기 (D: 일, M: 월, Q: 분기, A: 연)

required
start_date str

조회 시작일

required
end_date str

조회 종료일

required
item_code1 str

통계항목코드1

''
item_code2 str

통계항목코드2

''
item_code3 str

통계항목코드3

''
item_code4 str

통계항목코드4

''
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 100000

100000

Returns:

Type Description
dict

API 응답 데이터

get_statistic_item_list

get_statistic_item_list(stat_code: str, start: int = 1, end: int = 10000) -> dict[str, Any]

통계 항목 목록 조회 (StatisticItemList)

Parameters:

Name Type Description Default
stat_code str

통계표코드

required
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 10000

10000

Returns:

Type Description
dict

API 응답 데이터

get_statistic_table_list

get_statistic_table_list(stat_code: str = '', start: int = 1, end: int = 10000) -> dict[str, Any]

통계표 목록 조회 (StatisticTableList)

Parameters:

Name Type Description Default
stat_code str

통계표코드 (검색어로 활용)

''
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 10000

10000

Returns:

Type Description
dict

API 응답 데이터

get_statistic_word

get_statistic_word(word: str, start: int = 1, end: int = 10) -> dict[str, Any]

통계용어사전 조회 (StatisticWord)

Parameters:

Name Type Description Default
word str

검색할 통계 용어

required
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 10

10

Returns:

Type Description
dict

API 응답 데이터

get_key_statistic_list

get_key_statistic_list(start: int = 1, end: int = 100) -> dict[str, Any]

100대 통계지표 조회 (KeyStatisticList)

Parameters:

Name Type Description Default
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 100

100

Returns:

Type Description
dict

API 응답 데이터

get_statistic_meta

get_statistic_meta(data_name: str, start: int = 1, end: int = 10) -> dict[str, Any]

통계메타DB 조회 (StatisticMeta)

Parameters:

Name Type Description Default
data_name str

조회할 데이터명

required
start int

시작 건수, 기본값 1

1
end int

종료 건수, 기본값 10

10

Returns:

Type Description
dict

API 응답 데이터