opendart-fss 0.1.1__tar.gz → 0.2.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.1 → opendart_fss-0.2.0}/PKG-INFO +31 -30
  2. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/README.md +30 -29
  3. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/__init__.py +22 -19
  4. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/_version.py +2 -2
  5. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/client.py +24 -33
  6. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/verification/runner.py +1 -2
  7. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/test_client.py +6 -4
  8. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/uv.lock +1 -1
  9. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/.env.example +0 -0
  10. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/.github/workflows/publish.yml +0 -0
  11. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/.github/workflows/release.yml +0 -0
  12. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/.gitignore +0 -0
  13. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/.python-version +0 -0
  14. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/LICENSE +0 -0
  15. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/__init__.py +0 -0
  16. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/base.py +0 -0
  17. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/disclosure.py +0 -0
  18. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/financial.py +0 -0
  19. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/major_event.py +0 -0
  20. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/registration.py +0 -0
  21. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/report.py +0 -0
  22. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/api/shareholder.py +0 -0
  23. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/constants.py +0 -0
  24. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/exceptions.py +0 -0
  25. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/__init__.py +0 -0
  26. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/base.py +0 -0
  27. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/disclosure.py +0 -0
  28. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/financial.py +0 -0
  29. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/major_event.py +0 -0
  30. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/registration.py +0 -0
  31. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/report.py +0 -0
  32. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/models/shareholder.py +0 -0
  33. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/verification/__init__.py +0 -0
  34. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/verification/config.py +0 -0
  35. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/verification/rate_limiter.py +0 -0
  36. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/opendart_fss/verification/reporter.py +0 -0
  37. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/pyproject.toml +0 -0
  38. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/scripts/scrape_api_specs.py +0 -0
  39. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/scripts/verify_endpoints.py +0 -0
  40. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/all_apis.json +0 -0
  41. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/disclosure.json +0 -0
  42. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/financial.json +0 -0
  43. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/major_event.json +0 -0
  44. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/registration.json +0 -0
  45. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/report.json +0 -0
  46. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/specs/shareholder.json +0 -0
  47. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/__init__.py +0 -0
  48. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/conftest.py +0 -0
  49. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/integration/__init__.py +0 -0
  50. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/integration/conftest.py +0 -0
  51. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/integration/test_verification.py +0 -0
  52. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/test_exceptions.py +0 -0
  53. {opendart_fss-0.1.1 → opendart_fss-0.2.0}/tests/test_models.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opendart-fss
3
- Version: 0.1.1
3
+ Version: 0.2.0
4
4
  Summary: 금융감독원 전자공시시스템 OpenDART API Python SDK
5
5
  Project-URL: Homepage, https://github.com/hypn4/opendart-fss-python
6
6
  Project-URL: Documentation, https://github.com/hypn4/opendart-fss-python#readme
@@ -63,15 +63,13 @@ cp .env.example .env
63
63
 
64
64
  ```python
65
65
  # 환경변수가 설정되어 있으면 api_key 파라미터 생략 가능
66
- async with OpenDartClient() as client:
67
- ...
66
+ client = OpenDartClient()
68
67
  ```
69
68
 
70
69
  **2. 직접 전달**
71
70
 
72
71
  ```python
73
- async with OpenDartClient(api_key="YOUR_API_KEY") as client:
74
- ...
72
+ client = OpenDartClient(api_key="YOUR_API_KEY")
75
73
  ```
76
74
 
77
75
  ### 예제
@@ -81,31 +79,34 @@ import asyncio
81
79
  from opendart_fss import OpenDartClient
82
80
 
83
81
  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}")
82
+ client = OpenDartClient() # 환경변수에서 API 키 로드
83
+
84
+ # 공시 검색
85
+ disclosures = await client.disclosure.search(
86
+ corp_code="00126380",
87
+ bgn_de="20240101",
88
+ end_de="20241231"
89
+ )
90
+
91
+ for item in disclosures:
92
+ print(f"{item.rcept_dt} - {item.report_nm}")
93
+
94
+ # 기업 개황
95
+ company = await client.disclosure.get_company("00126380")
96
+ print(f"회사명: {company.corp_name}")
97
+ print(f"대표자: {company.ceo_nm}")
98
+
99
+ # 재무제표 조회
100
+ financials = await client.financial.get_single_account(
101
+ corp_code="00126380",
102
+ bsns_year="2024",
103
+ reprt_code="11011" # 사업보고서
104
+ )
105
+
106
+ for item in financials:
107
+ print(f"{item.account_nm}: {item.thstrm_amount}")
108
+
109
+ await client.close()
109
110
 
110
111
  asyncio.run(main())
111
112
  ```
@@ -36,15 +36,13 @@ cp .env.example .env
36
36
 
37
37
  ```python
38
38
  # 환경변수가 설정되어 있으면 api_key 파라미터 생략 가능
39
- async with OpenDartClient() as client:
40
- ...
39
+ client = OpenDartClient()
41
40
  ```
42
41
 
43
42
  **2. 직접 전달**
44
43
 
45
44
  ```python
46
- async with OpenDartClient(api_key="YOUR_API_KEY") as client:
47
- ...
45
+ client = OpenDartClient(api_key="YOUR_API_KEY")
48
46
  ```
49
47
 
50
48
  ### 예제
@@ -54,31 +52,34 @@ import asyncio
54
52
  from opendart_fss import OpenDartClient
55
53
 
56
54
  async def main():
57
- async with OpenDartClient() as client: # 환경변수에서 API 키 로드
58
- # 공시 검색
59
- disclosures = await client.disclosure.search(
60
- corp_code="00126380",
61
- bgn_de="20240101",
62
- end_de="20241231"
63
- )
64
-
65
- for item in disclosures:
66
- print(f"{item.rcept_dt} - {item.report_nm}")
67
-
68
- # 기업 개황
69
- company = await client.disclosure.get_company("00126380")
70
- print(f"회사명: {company.corp_name}")
71
- print(f"대표자: {company.ceo_nm}")
72
-
73
- # 재무제표 조회
74
- financials = await client.financial.get_single_account(
75
- corp_code="00126380",
76
- bsns_year="2024",
77
- reprt_code="11011" # 사업보고서
78
- )
79
-
80
- for item in financials:
81
- print(f"{item.account_nm}: {item.thstrm_amount}")
55
+ client = OpenDartClient() # 환경변수에서 API 키 로드
56
+
57
+ # 공시 검색
58
+ disclosures = await client.disclosure.search(
59
+ corp_code="00126380",
60
+ bgn_de="20240101",
61
+ end_de="20241231"
62
+ )
63
+
64
+ for item in disclosures:
65
+ print(f"{item.rcept_dt} - {item.report_nm}")
66
+
67
+ # 기업 개황
68
+ company = await client.disclosure.get_company("00126380")
69
+ print(f"회사명: {company.corp_name}")
70
+ print(f"대표자: {company.ceo_nm}")
71
+
72
+ # 재무제표 조회
73
+ financials = await client.financial.get_single_account(
74
+ corp_code="00126380",
75
+ bsns_year="2024",
76
+ reprt_code="11011" # 사업보고서
77
+ )
78
+
79
+ for item in financials:
80
+ print(f"{item.account_nm}: {item.thstrm_amount}")
81
+
82
+ await client.close()
82
83
 
83
84
  asyncio.run(main())
84
85
  ```
@@ -8,28 +8,31 @@ Example:
8
8
  from opendart_fss import OpenDartClient
9
9
 
10
10
  async def main():
11
- async with OpenDartClient(api_key="YOUR_API_KEY") as client:
12
- # 공시 검색
13
- disclosures = await client.disclosure.search(
14
- corp_code="00126380",
15
- bgn_de="20240101",
16
- end_de="20241231"
17
- )
11
+ client = OpenDartClient(api_key="YOUR_API_KEY")
18
12
 
19
- # 기업 개황
20
- company = await client.disclosure.get_company("00126380")
21
- print(f"회사명: {company.corp_name}")
22
- print(f"대표자: {company.ceo_nm}")
13
+ # 공시 검색
14
+ disclosures = await client.disclosure.search(
15
+ corp_code="00126380",
16
+ bgn_de="20240101",
17
+ end_de="20241231"
18
+ )
23
19
 
24
- # 재무제표 조회
25
- financials = await client.financial.get_single_account(
26
- corp_code="00126380",
27
- bsns_year="2024",
28
- reprt_code="11011" # 사업보고서
29
- )
20
+ # 기업 개황
21
+ company = await client.disclosure.get_company("00126380")
22
+ print(f"회사명: {company.corp_name}")
23
+ print(f"대표자: {company.ceo_nm}")
30
24
 
31
- for item in financials:
32
- print(f"{item.account_nm}: {item.thstrm_amount}")
25
+ # 재무제표 조회
26
+ financials = await client.financial.get_single_account(
27
+ corp_code="00126380",
28
+ bsns_year="2024",
29
+ reprt_code="11011" # 사업보고서
30
+ )
31
+
32
+ for item in financials:
33
+ print(f"{item.account_nm}: {item.thstrm_amount}")
34
+
35
+ await client.close()
33
36
 
34
37
  asyncio.run(main())
35
38
  ```
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.1.1'
32
- __version_tuple__ = version_tuple = (0, 1, 1)
31
+ __version__ = version = '0.2.0'
32
+ __version_tuple__ = version_tuple = (0, 2, 0)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -1,7 +1,6 @@
1
1
  """OpenDART API 클라이언트."""
2
2
 
3
3
  import os
4
- from types import TracebackType
5
4
 
6
5
  import httpx
7
6
  from dotenv import load_dotenv
@@ -21,24 +20,27 @@ class OpenDartClient:
21
20
 
22
21
  Example:
23
22
  ```python
24
- async with OpenDartClient(api_key="YOUR_API_KEY") as client:
25
- # 공시 검색
26
- disclosures = await client.disclosure.search(
27
- corp_code="00126380",
28
- bgn_de="20240101",
29
- end_de="20241231"
30
- )
31
-
32
- # 기업 개황
33
- company = await client.disclosure.get_company("00126380")
34
- print(f"회사명: {company.corp_name}")
35
-
36
- # 재무제표 조회
37
- financials = await client.financial.get_single_account(
38
- corp_code="00126380",
39
- bsns_year="2024",
40
- reprt_code="11011"
41
- )
23
+ client = OpenDartClient(api_key="YOUR_API_KEY")
24
+
25
+ # 공시 검색
26
+ disclosures = await client.disclosure.search(
27
+ corp_code="00126380",
28
+ bgn_de="20240101",
29
+ end_de="20241231"
30
+ )
31
+
32
+ # 기업 개황
33
+ company = await client.disclosure.get_company("00126380")
34
+ print(f"회사명: {company.corp_name}")
35
+
36
+ # 재무제표 조회
37
+ financials = await client.financial.get_single_account(
38
+ corp_code="00126380",
39
+ bsns_year="2024",
40
+ reprt_code="11011"
41
+ )
42
+
43
+ await client.close() # 또는 contextlib.aclosing() 사용
42
44
  ```
43
45
  """
44
46
 
@@ -77,20 +79,9 @@ class OpenDartClient:
77
79
  self.major_event = MajorEventAPI(self)
78
80
  self.registration = RegistrationAPI(self)
79
81
 
80
- async def __aenter__(self) -> "OpenDartClient":
81
- """컨텍스트 매니저 진입."""
82
- return self
83
-
84
- async def __aexit__(
85
- self,
86
- _exc_type: type[BaseException] | None,
87
- _exc_val: BaseException | None,
88
- _exc_tb: TracebackType | None,
89
- ) -> None:
90
- """컨텍스트 매니저 종료."""
91
- await self.close()
92
-
93
- async def close(self) -> None:
82
+ async def aclose(self) -> None:
94
83
  """HTTP 클라이언트 종료."""
95
84
  if not self._external_client:
96
85
  await self._http.aclose()
86
+
87
+ close = aclose # alias
@@ -60,13 +60,12 @@ class EndpointVerifier:
60
60
  async def __aenter__(self) -> "EndpointVerifier":
61
61
  """컨텍스트 매니저 진입."""
62
62
  self._client = OpenDartClient(api_key=self._api_key)
63
- await self._client.__aenter__()
64
63
  return self
65
64
 
66
65
  async def __aexit__(self, *args: Any) -> None:
67
66
  """컨텍스트 매니저 종료."""
68
67
  if self._client:
69
- await self._client.__aexit__(*args)
68
+ await self._client.close()
70
69
 
71
70
  async def verify_all(
72
71
  self,
@@ -1,5 +1,7 @@
1
1
  """클라이언트 테스트."""
2
2
 
3
+ from contextlib import aclosing
4
+
3
5
  import pytest
4
6
 
5
7
  from opendart_fss import OpenDartClient
@@ -27,13 +29,13 @@ class TestOpenDartClient:
27
29
  assert isinstance(client.registration, RegistrationAPI)
28
30
 
29
31
  @pytest.mark.asyncio
30
- async def test_client_context_manager(self, api_key: str) -> None:
31
- """컨텍스트 매니저 테스트."""
32
- async with OpenDartClient(api_key=api_key) as client:
32
+ async def test_client_aclosing(self, api_key: str) -> None:
33
+ """contextlib.aclosing을 통한 자동 정리 테스트."""
34
+ async with aclosing(OpenDartClient(api_key=api_key)) as client:
33
35
  assert client.api_key == api_key
34
36
  assert not client._http.is_closed
35
37
 
36
- # 컨텍스트 종료 후 HTTP 클라이언트가 닫혀야 함
38
+ # aclosing 종료 후 HTTP 클라이언트가 닫혀야 함
37
39
  assert client._http.is_closed
38
40
 
39
41
  @pytest.mark.asyncio
@@ -1134,7 +1134,7 @@ wheels = [
1134
1134
  ]
1135
1135
 
1136
1136
  [[package]]
1137
- name = "opendart-fss-python"
1137
+ name = "opendart-fss"
1138
1138
  source = { editable = "." }
1139
1139
  dependencies = [
1140
1140
  { name = "httpx" },
File without changes
File without changes
File without changes