opendart-fss 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. opendart_fss-0.1.0/.env.example +1 -0
  2. opendart_fss-0.1.0/.github/workflows/publish.yml +28 -0
  3. opendart_fss-0.1.0/.github/workflows/release.yml +34 -0
  4. opendart_fss-0.1.0/.gitignore +33 -0
  5. opendart_fss-0.1.0/.python-version +1 -0
  6. opendart_fss-0.1.0/LICENSE +21 -0
  7. opendart_fss-0.1.0/PKG-INFO +308 -0
  8. opendart_fss-0.1.0/README.md +281 -0
  9. opendart_fss-0.1.0/opendart_fss/__init__.py +77 -0
  10. opendart_fss-0.1.0/opendart_fss/_version.py +34 -0
  11. opendart_fss-0.1.0/opendart_fss/api/__init__.py +19 -0
  12. opendart_fss-0.1.0/opendart_fss/api/base.py +72 -0
  13. opendart_fss-0.1.0/opendart_fss/api/disclosure.py +103 -0
  14. opendart_fss-0.1.0/opendart_fss/api/financial.py +206 -0
  15. opendart_fss-0.1.0/opendart_fss/api/major_event.py +1051 -0
  16. opendart_fss-0.1.0/opendart_fss/api/registration.py +183 -0
  17. opendart_fss-0.1.0/opendart_fss/api/report.py +821 -0
  18. opendart_fss-0.1.0/opendart_fss/api/shareholder.py +51 -0
  19. opendart_fss-0.1.0/opendart_fss/client.py +96 -0
  20. opendart_fss-0.1.0/opendart_fss/constants.py +88 -0
  21. opendart_fss-0.1.0/opendart_fss/exceptions.py +90 -0
  22. opendart_fss-0.1.0/opendart_fss/models/__init__.py +124 -0
  23. opendart_fss-0.1.0/opendart_fss/models/base.py +10 -0
  24. opendart_fss-0.1.0/opendart_fss/models/disclosure.py +106 -0
  25. opendart_fss-0.1.0/opendart_fss/models/financial.py +85 -0
  26. opendart_fss-0.1.0/opendart_fss/models/major_event.py +863 -0
  27. opendart_fss-0.1.0/opendart_fss/models/registration.py +186 -0
  28. opendart_fss-0.1.0/opendart_fss/models/report.py +691 -0
  29. opendart_fss-0.1.0/opendart_fss/models/shareholder.py +54 -0
  30. opendart_fss-0.1.0/opendart_fss/verification/__init__.py +50 -0
  31. opendart_fss-0.1.0/opendart_fss/verification/config.py +450 -0
  32. opendart_fss-0.1.0/opendart_fss/verification/rate_limiter.py +92 -0
  33. opendart_fss-0.1.0/opendart_fss/verification/reporter.py +255 -0
  34. opendart_fss-0.1.0/opendart_fss/verification/runner.py +326 -0
  35. opendart_fss-0.1.0/pyproject.toml +60 -0
  36. opendart_fss-0.1.0/scripts/scrape_api_specs.py +202 -0
  37. opendart_fss-0.1.0/scripts/verify_endpoints.py +125 -0
  38. opendart_fss-0.1.0/specs/all_apis.json +14308 -0
  39. opendart_fss-0.1.0/specs/disclosure.json +397 -0
  40. opendart_fss-0.1.0/specs/financial.json +871 -0
  41. opendart_fss-0.1.0/specs/major_event.json +7671 -0
  42. opendart_fss-0.1.0/specs/registration.json +1896 -0
  43. opendart_fss-0.1.0/specs/report.json +3254 -0
  44. opendart_fss-0.1.0/specs/shareholder.json +217 -0
  45. opendart_fss-0.1.0/tests/__init__.py +1 -0
  46. opendart_fss-0.1.0/tests/conftest.py +17 -0
  47. opendart_fss-0.1.0/tests/integration/__init__.py +1 -0
  48. opendart_fss-0.1.0/tests/integration/conftest.py +39 -0
  49. opendart_fss-0.1.0/tests/integration/test_verification.py +144 -0
  50. opendart_fss-0.1.0/tests/test_client.py +46 -0
  51. opendart_fss-0.1.0/tests/test_exceptions.py +93 -0
  52. opendart_fss-0.1.0/tests/test_models.py +130 -0
  53. opendart_fss-0.1.0/uv.lock +2019 -0
@@ -0,0 +1 @@
1
+ OPENDART_API_KEY=your_api_key_here
@@ -0,0 +1,28 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ environment: pypi
12
+ permissions:
13
+ id-token: write # Trusted Publisher (OIDC) 인증용
14
+ contents: read
15
+ steps:
16
+ - name: Checkout
17
+ uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0 # hatch-vcs 버전 태깅에 필요
20
+
21
+ - name: Install uv
22
+ uses: astral-sh/setup-uv@v7
23
+
24
+ - name: Build package
25
+ run: uv build
26
+
27
+ - name: Publish to PyPI
28
+ run: uv publish
@@ -0,0 +1,34 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v6
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Generate changelog
20
+ uses: orhun/git-cliff-action@v4
21
+ id: changelog
22
+ with:
23
+ config: github
24
+ args: --latest --strip header
25
+ env:
26
+ GITHUB_REPO: ${{ github.repository }}
27
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+
29
+ - name: Create Release
30
+ uses: softprops/action-gh-release@v2
31
+ with:
32
+ body: ${{ steps.changelog.outputs.content }}
33
+ env:
34
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,33 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # hatch-vcs generated version file
13
+ opendart_fss/_version.py
14
+
15
+ # Environment variables
16
+ .env
17
+ .env.local
18
+
19
+ # Testing/Linting cache
20
+ .pytest_cache/
21
+ .ruff_cache/
22
+ .mypy_cache/
23
+ .coverage
24
+ htmlcov/
25
+
26
+ # IDE
27
+ .idea/
28
+ .vscode/
29
+ *.code-workspace
30
+
31
+ # OS
32
+ .DS_Store
33
+ Thumbs.db
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 hypn4
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,308 @@
1
+ Metadata-Version: 2.4
2
+ Name: opendart-fss
3
+ Version: 0.1.0
4
+ Summary: 금융감독원 전자공시시스템 OpenDART API Python SDK
5
+ Project-URL: Homepage, https://github.com/hypn4/opendart-fss-python
6
+ Project-URL: Documentation, https://github.com/hypn4/opendart-fss-python#readme
7
+ Project-URL: Repository, https://github.com/hypn4/opendart-fss-python
8
+ Author: OpenDART FSS Python Contributors
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,dart,disclosure,finance,fss,korea,opendart
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Financial and Insurance Industry
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Office/Business :: Financial
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.14
23
+ Requires-Dist: httpx>=0.28.1
24
+ Requires-Dist: msgspec>=0.20.0
25
+ Requires-Dist: python-dotenv>=1.2.1
26
+ Description-Content-Type: text/markdown
27
+
28
+ # OpenDART FSS Python SDK
29
+
30
+ 금융감독원 전자공시시스템 [OpenDART](https://opendart.fss.or.kr/) API를 위한 Python SDK입니다.
31
+
32
+ ## 특징
33
+
34
+ - **Async only**: `httpx.AsyncClient` 기반의 비동기 API
35
+ - **타입 안전**: `msgspec`를 사용한 고성능 데이터 검증
36
+ - **전체 API 지원**: 6개 카테고리 83개 API 엔드포인트
37
+
38
+ ## 설치
39
+
40
+ ```bash
41
+ pip install opendart-fss-python
42
+ ```
43
+
44
+ 또는 uv 사용:
45
+
46
+ ```bash
47
+ uv add opendart-fss-python
48
+ ```
49
+
50
+ ## 빠른 시작
51
+
52
+ ### API 키 설정
53
+
54
+ OpenDART API 키는 두 가지 방법으로 설정할 수 있습니다:
55
+
56
+ **1. 환경변수 사용 (권장)**
57
+
58
+ ```bash
59
+ # .env 파일 생성
60
+ cp .env.example .env
61
+ # .env 파일을 열고 API 키 입력
62
+ ```
63
+
64
+ ```python
65
+ # 환경변수가 설정되어 있으면 api_key 파라미터 생략 가능
66
+ async with OpenDartClient() as client:
67
+ ...
68
+ ```
69
+
70
+ **2. 직접 전달**
71
+
72
+ ```python
73
+ async with OpenDartClient(api_key="YOUR_API_KEY") as client:
74
+ ...
75
+ ```
76
+
77
+ ### 예제
78
+
79
+ ```python
80
+ import asyncio
81
+ from opendart_fss import OpenDartClient
82
+
83
+ async def main():
84
+ async with OpenDartClient() as client: # 환경변수에서 API 키 로드
85
+ # 공시 검색
86
+ disclosures = await client.disclosure.search(
87
+ corp_code="00126380",
88
+ bgn_de="20240101",
89
+ end_de="20241231"
90
+ )
91
+
92
+ for item in disclosures:
93
+ print(f"{item.rcept_dt} - {item.report_nm}")
94
+
95
+ # 기업 개황
96
+ company = await client.disclosure.get_company("00126380")
97
+ print(f"회사명: {company.corp_name}")
98
+ print(f"대표자: {company.ceo_nm}")
99
+
100
+ # 재무제표 조회
101
+ financials = await client.financial.get_single_account(
102
+ corp_code="00126380",
103
+ bsns_year="2024",
104
+ reprt_code="11011" # 사업보고서
105
+ )
106
+
107
+ for item in financials:
108
+ print(f"{item.account_nm}: {item.thstrm_amount}")
109
+
110
+ asyncio.run(main())
111
+ ```
112
+
113
+ ## API 카테고리
114
+
115
+ ### DS001 공시정보 (4개)
116
+ - `client.disclosure.search()` - 공시검색
117
+ - `client.disclosure.get_company()` - 기업개황
118
+ - `client.disclosure.download_document()` - 공시서류 원본 다운로드
119
+ - `client.disclosure.download_corp_codes()` - 고유번호 전체 다운로드
120
+
121
+ ### DS002 정기보고서 주요정보 (28개)
122
+ - `client.report.get_stock_changes()` - 증자(감자) 현황
123
+ - `client.report.get_dividends()` - 배당에 관한 사항
124
+ - `client.report.get_treasury_stock()` - 자기주식 취득/처분 현황
125
+ - `client.report.get_largest_shareholders()` - 최대주주 현황
126
+ - `client.report.get_largest_shareholder_changes()` - 최대주주 변동 현황
127
+ - `client.report.get_minority_shareholders()` - 소액주주 현황
128
+ - `client.report.get_executives()` - 임원 현황
129
+ - `client.report.get_employees()` - 직원 현황
130
+ - `client.report.get_individual_compensation()` - 개인별 보수 현황
131
+ - `client.report.get_director_compensation()` - 이사/감사 보수 현황
132
+ - `client.report.get_director_individual_compensation()` - 이사/감사 개인별 보수 현황
133
+ - `client.report.get_director_compensation_approval()` - 이사/감사 보수승인 현황
134
+ - `client.report.get_director_compensation_by_type()` - 유형별 이사/감사 보수 현황
135
+ - `client.report.get_unregistered_executive_compensation()` - 미등기임원 보수 현황
136
+ - `client.report.get_total_stock_quantity()` - 주식 총수 현황
137
+ - `client.report.get_debt_securities_issuance()` - 채무증권 발행실적
138
+ - `client.report.get_commercial_paper_balance()` - 기업어음증권 미상환 잔액
139
+ - `client.report.get_short_term_bond_balance()` - 단기사채 미상환 잔액
140
+ - `client.report.get_corporate_bond_balance()` - 회사채 미상환 잔액
141
+ - `client.report.get_hybrid_securities_balance()` - 신종자본증권 미상환 잔액
142
+ - `client.report.get_contingent_capital_balance()` - 조건부자본증권 미상환 잔액
143
+ - `client.report.get_auditor_opinion()` - 회계감사인 의견
144
+ - `client.report.get_audit_service_contract()` - 감사용역 계약 현황
145
+ - `client.report.get_non_audit_service_contract()` - 비감사용역 계약 현황
146
+ - `client.report.get_outside_directors()` - 사외이사 현황
147
+ - `client.report.get_other_corp_investments()` - 타법인 출자 현황
148
+ - `client.report.get_public_offering_fund_usage()` - 공모자금 사용 현황
149
+ - `client.report.get_private_placement_fund_usage()` - 사모자금 사용 현황
150
+
151
+ ### DS003 정기보고서 재무정보 (6개)
152
+ - `client.financial.get_single_account()` - 단일회사 주요계정
153
+ - `client.financial.get_multi_account()` - 다중회사 주요계정
154
+ - `client.financial.get_full_statements()` - 전체 재무제표
155
+ - `client.financial.download_xbrl()` - XBRL 원본파일 다운로드
156
+ - `client.financial.get_xbrl_taxonomy()` - XBRL 택사노미
157
+ - `client.financial.get_single_indicators()` - 단일회사 재무지표
158
+
159
+ ### DS004 지분공시 종합정보 (2개)
160
+ - `client.shareholder.get_major_stock()` - 대량보유 상황보고
161
+ - `client.shareholder.get_executive_stock()` - 임원/주요주주 소유보고
162
+
163
+ ### DS005 주요사항보고서 (36개)
164
+ - `client.major_event.get_paid_capital_increase()` - 유상증자 결정
165
+ - `client.major_event.get_bonus_issue()` - 무상증자 결정
166
+ - `client.major_event.get_mixed_capital_increase()` - 유무상증자 결정
167
+ - `client.major_event.get_capital_reduction()` - 감자 결정
168
+ - `client.major_event.get_convertible_bond()` - 전환사채권 발행결정
169
+ - `client.major_event.get_bond_with_warrant()` - 신주인수권부사채권 발행결정
170
+ - `client.major_event.get_exchangeable_bond()` - 교환사채권 발행결정
171
+ - `client.major_event.get_write_off_contingent_capital()` - 상각형 조건부자본증권 발행결정
172
+ - `client.major_event.get_merger_decision()` - 합병 결정
173
+ - `client.major_event.get_split_decision()` - 분할 결정
174
+ - `client.major_event.get_split_merger_decision()` - 분할합병 결정
175
+ - `client.major_event.get_stock_exchange_decision()` - 주식 포괄적 교환·이전 결정
176
+ - `client.major_event.get_treasury_stock_acquisition()` - 자기주식 취득 결정
177
+ - `client.major_event.get_treasury_stock_disposal()` - 자기주식 처분 결정
178
+ - `client.major_event.get_treasury_trust_contract()` - 자기주식취득 신탁계약 체결 결정
179
+ - `client.major_event.get_treasury_trust_termination()` - 자기주식취득 신탁계약 해지 결정
180
+ - `client.major_event.get_business_acquisition()` - 영업양수 결정
181
+ - `client.major_event.get_business_disposal()` - 영업양도 결정
182
+ - `client.major_event.get_tangible_asset_acquisition()` - 유형자산 양수 결정
183
+ - `client.major_event.get_tangible_asset_disposal()` - 유형자산 양도 결정
184
+ - `client.major_event.get_other_corp_stock_acquisition()` - 타법인 주식 및 출자증권 양수 결정
185
+ - `client.major_event.get_other_corp_stock_disposal()` - 타법인 주식 및 출자증권 양도 결정
186
+ - `client.major_event.get_stock_related_bond_acquisition()` - 주권 관련 사채권 양수 결정
187
+ - `client.major_event.get_stock_related_bond_disposal()` - 주권 관련 사채권 양도 결정
188
+ - `client.major_event.get_asset_transfer()` - 영업양수도 등
189
+ - `client.major_event.get_default_occurrence()` - 채무불이행 등 발생
190
+ - `client.major_event.get_business_suspension()` - 영업정지 등
191
+ - `client.major_event.get_rehabilitation_filing()` - 회생절차 개시신청
192
+ - `client.major_event.get_dissolution_reason()` - 해산사유 발생
193
+ - `client.major_event.get_creditor_management_start()` - 채권자관리절차 개시신청
194
+ - `client.major_event.get_creditor_management_stop()` - 채권자관리절차 중단
195
+ - `client.major_event.get_litigation()` - 소송 등의 제기
196
+ - `client.major_event.get_overseas_listing_decision()` - 해외증권시장 주권등 상장결정
197
+ - `client.major_event.get_overseas_delisting_decision()` - 해외증권시장 주권등 상장폐지결정
198
+ - `client.major_event.get_overseas_listing()` - 해외증권시장 주권등 상장
199
+ - `client.major_event.get_overseas_delisting()` - 해외증권시장 주권등 상장폐지
200
+
201
+ ### DS006 증권신고서 (6개)
202
+ - `client.registration.get_equity_securities()` - 지분증권 발행
203
+ - `client.registration.get_debt_securities()` - 채무증권 발행
204
+ - `client.registration.get_merger_registration()` - 합병 신고
205
+ - `client.registration.get_split_registration()` - 분할 신고
206
+ - `client.registration.get_depositary_receipt()` - 증권예탁증권
207
+ - `client.registration.get_stock_exchange_transfer()` - 주식의 포괄적 교환·이전
208
+
209
+ ## 보고서 코드
210
+
211
+ | 코드 | 설명 |
212
+ |------|------|
213
+ | 11013 | 1분기보고서 |
214
+ | 11012 | 반기보고서 |
215
+ | 11014 | 3분기보고서 |
216
+ | 11011 | 사업보고서 |
217
+
218
+ ```python
219
+ from opendart_fss import ReportCode
220
+
221
+ # 사업보고서 조회
222
+ financials = await client.financial.get_single_account(
223
+ corp_code="00126380",
224
+ bsns_year="2024",
225
+ reprt_code=ReportCode.ANNUAL # "11011"
226
+ )
227
+ ```
228
+
229
+ ## 에러 처리
230
+
231
+ ```python
232
+ from opendart_fss import (
233
+ AuthenticationError,
234
+ RateLimitError,
235
+ ValidationError,
236
+ NotFoundError,
237
+ ServerError,
238
+ )
239
+
240
+ try:
241
+ company = await client.disclosure.get_company("invalid_code")
242
+ except AuthenticationError:
243
+ print("API 키가 유효하지 않습니다")
244
+ except RateLimitError:
245
+ print("요청 한도를 초과했습니다")
246
+ except ValidationError:
247
+ print("잘못된 파라미터입니다")
248
+ except NotFoundError:
249
+ print("데이터를 찾을 수 없습니다")
250
+ except ServerError:
251
+ print("서버 오류가 발생했습니다")
252
+ ```
253
+
254
+ ## API 엔드포인트 검증
255
+
256
+ 모든 API 엔드포인트가 정상 작동하는지 검증할 수 있습니다.
257
+
258
+ ```bash
259
+ # 전체 엔드포인트 검증 (콘솔 출력)
260
+ uv run python scripts/verify_endpoints.py
261
+
262
+ # JSON 형식 출력
263
+ uv run python scripts/verify_endpoints.py --format json
264
+
265
+ # 마크다운 리포트 저장
266
+ uv run python scripts/verify_endpoints.py --format markdown -o report.md
267
+
268
+ # 특정 카테고리만 검증
269
+ uv run python scripts/verify_endpoints.py --category DS001
270
+
271
+ # 특정 엔드포인트만 검증
272
+ uv run python scripts/verify_endpoints.py --endpoint DS001-02
273
+ ```
274
+
275
+ 프로그래밍 방식으로도 사용할 수 있습니다:
276
+
277
+ ```python
278
+ import asyncio
279
+ from opendart_fss.verification import EndpointVerifier, generate_report
280
+
281
+ async def main():
282
+ async with EndpointVerifier() as verifier:
283
+ results = await verifier.verify_all()
284
+ report = generate_report(results, duration_seconds=0, format="console")
285
+ print(report)
286
+
287
+ asyncio.run(main())
288
+ ```
289
+
290
+ ## 개발
291
+
292
+ ```bash
293
+ # 의존성 설치
294
+ uv sync --group dev
295
+
296
+ # 테스트 실행
297
+ uv run pytest
298
+
299
+ # 통합 테스트 실행 (실제 API 호출)
300
+ uv run pytest tests/integration/ -v -m integration
301
+
302
+ # API 명세 스크래핑 (개발용)
303
+ uv run python scripts/scrape_api_specs.py
304
+ ```
305
+
306
+ ## 라이선스
307
+
308
+ MIT License