josw123 / dart-fss

한국 금융감독원에서 운영하는 다트(Dart) 시스템 크롤링을 위한 라이브러리
https://github.com/josw123/dart-fss
MIT License
319 stars 111 forks source link

현재 xbrl원문 받아오기가 안됩니다. #143

Closed sukwoo1414 closed 8 months ago

sukwoo1414 commented 8 months ago

지난 분기 재무제표는 받아지는데 이번분기 데이터부터 analyze_xbrl()의 값이 None입니다. 분기보고서 검색은 되는데 report.xbrl이 None인것 같습니다. 라이브러리의 문제인가요 아니면 opendart에서 뭔가 바꾼건가요?

0x68756d8616e6f69664 commented 8 months ago

동일 이슈로 문의드립니다.

josw123 commented 8 months ago

확인해보고 곧바로 답변 드리도록 하겠습니다.

josw123 commented 8 months ago

안녕하세요. 확인해보니 DART 사이트 개편으로 인해, XBRL 파일뷰어가 신설되었으며, 이로 인해 기존에 사업보고서(분기보고서 등)에 첨부되었던 XBRL 파일 첨부가 아래와 같이 XBRL 뷰어로 분리된 것으로 확인 됩니다.

image

문제는 이로 인하여 OPENDART에서 제공하는 XBRL 다운로드 API 또한 먹통이 된것으로 생각됩니다. 빠른 시간내에 분석하여 수정된 버전을 제공해 드리도록 하겠습니다.

josw123 commented 8 months ago

버그 수정 후 배포 완료 했습니다. 버그 리포트 감사합니다.

sukwoo1414 commented 8 months ago

배포된 최신 버전 사용시 다수 종목에서 아래와 같은 오류가 발생합니다. 종목은 035460, 03490, 034810, ... 등입니다.

Traceback (most recent call last):
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 404, in load_xbrl
    file_path = download_xbrl(path=path, rcept_no=self.rcept_no)
  File "/home/swy/.local/lib/python3.10/site-packages/dart_fss/api/finance/xbrl.py", line 38, in download_xbrl
    resp = request.download(url=url, path=temp, payload=payload)
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/utils/request.py", line 248, in download
    raise FileNotFoundError('target does not exist')
FileNotFoundError: target does not exist

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/swyang/test/report.py", line 162, in do_get_fn_from_report
    return analyze_xbrl(report,
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/fs/extract.py", line 1098, in analyze_xbrl
    xbrl = report.xbrl
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 395, in xbrl
    self.load_xbrl()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 407, in load_xbrl
    xbrl_attached = self._get_xbrl()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 428, in _get_xbrl
    attached_files = self.find_all(**query)
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 389, in find_all
    dataset[s] = func_set[s]()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 376, in fn_xbrlviewer
    def fn_xbrlviewer(): return self.xbrlviewer.find_all(**kwargs)
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 312, in xbrlviewer
    self.extract_xbrlviewer()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/reports.py", line 317, in extract_xbrlviewer
    self._xbrlviewer = XBRLViewer(self.rcp_no, lazy_loading=False)
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/xbrl_viewer.py", line 36, in __init__
    self.load()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/xbrl_viewer.py", line 109, in load
    self.extract_attached_files()
  File "/home/swyang/.local/lib/python3.10/site-packages/dart_fss/filings/xbrl_viewer.py", line 100, in extract_attached_files
    url_path = tds[1].find('a')['href']

analyze_xbrl() 호출시 사용한 코드는 아래와 같습니다.

from dart_fss.fs.extract import analyze_xbrl
...
def do_get_fn_from_report(report):
    try:
        return analyze_xbrl(report, 
                        separate=True,
                        show_abstract=False,
                        show_class=False,
                        show_concept=True,
                        )
    ...

재시도해도 동일한 종목에서 동일한 에러가 발생합니다. 제 로컬 문제일까요?