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.1.tar.gz (6.8 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.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ecos_api-0.1.1.tar.gz
Algorithm Hash digest
SHA256 42da4a6ffd028802cacb00b50acd3762d4b5adbf26d6a54831efb8a12cad2f1d
MD5 dcd298dfa3b922d7a11d6147f4ff1d35
BLAKE2b-256 74bf2d2eca898176f1bdbce7156fcfb4b9b8caa7be13ed9e933dfaeaa81451ac

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ecos_api-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc029a465af0484d0b0b5d12fc2659cc8df99f8f393825a2c68efca89ccf1e9
MD5 b7f8a73597bfd4d10139324e7411924a
BLAKE2b-256 49f4fa755f2e487303184885d409c9c1f75ed8ba07a4d9bed64935ecbc4358bb

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