Skip to main content

한국은행 경제통계시스템(ECOS) REST API Python 클라이언트

Project description

ecos-api

한국은행 경제통계시스템(ECOS) REST API Python 클라이언트

설치

pip install ecos-api

사용법

ECOS Open API 인증키를 발급받아 사용합니다.

기본 사용

from ecos import EcosClient, Cycle

client = EcosClient("YOUR_API_KEY")

# 통계 데이터 조회 (GDP, 연간, 2020~2023)
rows = client.search("200Y001", Cycle.ANNUAL, "2020", "2023")
for row in rows:
    print(row.time, row.item_name1, row.data_value)

# 주요통계 100선
stats = client.get_key_statistics()
for s in stats:
    print(s.keystat_name, s.data_value, s.unit_name)

# 통계표 목록 조회
tables = client.list_tables()

# 통계표 항목 조회
items = client.list_items("200Y001")

# 통계표 메타데이터 조회
meta = client.get_meta("200Y001")

# 통계 용어 검색
words = client.search_word("GDP")

비동기 사용

import asyncio
from ecos import EcosClient, Cycle

async def main():
    async with EcosClient("YOUR_API_KEY") as client:
        rows = await client.search_async("200Y001", Cycle.ANNUAL, "2020", "2023")
        for row in rows:
            print(row.time, row.data_value)

asyncio.run(main())

Context Manager

with EcosClient("YOUR_API_KEY") as client:
    rows = client.search("731Y001", Cycle.DAILY, "20240101", "20240131")

API 메서드

메서드 비동기 설명
search() search_async() 통계 데이터 조회
list_tables() list_tables_async() 통계표 목록 조회
list_items() list_items_async() 통계 항목 목록 조회
get_meta() get_meta_async() 통계표 메타데이터 조회
get_key_statistics() get_key_statistics_async() 주요통계 100선
search_word() search_word_async() 통계 용어 검색

주기 코드 (Cycle)

설명 날짜 형식
Cycle.ANNUAL 연간 2020
Cycle.QUARTER 분기 20201
Cycle.MONTHLY 월간 202001
Cycle.SEMI_ANNUAL 반기 20201
Cycle.DAILY 일별 20200101

개발

pip install -e ".[dev]"
pytest
ruff check .
mypy src/

라이선스

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ecos_api-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ecos_api-0.1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file ecos_api-0.1.2.tar.gz.

File metadata

  • Download URL: ecos_api-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for ecos_api-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d51f0eff894719d0beaa6ceb3181eb56731f6d6b1fd2bcfeaaf7ddab8d2f0d6a
MD5 55b436561976fb73cf95d9ca53e3c579
BLAKE2b-256 8dc381025406540c5bc0c90c11e5baf8e60c9e6b71d374a59abbd85b24f00a7b

See more details on using hashes here.

File details

Details for the file ecos_api-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ecos_api-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for ecos_api-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5b845da489156060ab4360d5ec75d2ac7f9e6f32eac7912815a6d4c3162d6a7a
MD5 07f615ec366b76a5a75de3427f5314d7
BLAKE2b-256 c018af1735e469d981f31493575368a9386ce8a5cd526da1e15f0a5b7a2990c8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page