High-quality Python client for KR Public Data Portal
Project description
kr-data-portal-client
Production-ready, async-first Python client for the KR Public Data Portal (공공데이터포털).
Features
- Async First: Built on
httpxfor high-performance asynchronous operations. - Spec-Driven: Generated from YAML specifications to ensure accuracy.
- Robust Models: Uses Pydantic for strict response validation and easy data access.
- Rate Limiting: Built-in async rate limiter to comply with portal usage policies.
- Google-Style Docstrings: Full IDE support with detailed parameter descriptions and data update policies.
Installation
pip install kr-data-portal-client
Quick Start
import asyncio
from kr_data_portal.financial_services import FinancialClient
from kr_data_portal.models.financial_services import StockPriceInfoItem
async def main():
service_key = "YOUR_SERVICE_KEY"
async with FinancialClient(service_key=service_key) as client:
# Fetch stock price info
response = await client.getStockPriceInfo(itmsNm="삼성전자")
# Access validated items
items = response.items(StockPriceInfoItem)
for item in items:
print(f"{item.itmsNm}: {item.clpr} KRW")
if __name__ == "__main__":
asyncio.run(main())
Development
Project Structure
src/kr_data_portal/: Core package.specs/: API specification files (YAML).scripts/: Code generation scripts.tests/: Unit tests.
Code Generation
To regenerate the client from specifications:
python scripts/generate_client.py
Running Tests
pytest tests/
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kr_data_portal_client-0.1.8.tar.gz.
File metadata
- Download URL: kr_data_portal_client-0.1.8.tar.gz
- Upload date:
- Size: 46.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbbb52a9793d75f3aa90662a8ce215a39814c63920e8423c5f51afaf24dba3bf
|
|
| MD5 |
1c8ee88935d339d1dcb6fae46656e461
|
|
| BLAKE2b-256 |
fa0ea414b33229902f18735caeb75574eea0190a553494e20c91e385416d31ea
|
File details
Details for the file kr_data_portal_client-0.1.8-py3-none-any.whl.
File metadata
- Download URL: kr_data_portal_client-0.1.8-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98e7597af5dfdf86c3a8e03180dad3b8ba4368d8d388654052c1fc2d8f493aa0
|
|
| MD5 |
909680952906e0ee5b6280cd299fd3cf
|
|
| BLAKE2b-256 |
eec5194875d254c8e9ce6b9c3725365ffe8b55a49600a5004e1eeecdeb4204ec
|