Esempio n. 1
0
 def xbrl(self):
     """ XBRL 데이터 반환"""
     import tempfile
     if self._xbrl is None:
         with tempfile.TemporaryDirectory() as path:
             try:
                 file_path = download_xbrl(path=path,
                                           rcept_no=self.rcept_no)
                 self._xbrl = get_xbrl_from_file(file_path)
             except FileNotFoundError:
                 xbrl_attached = self._get_xbrl()
                 if xbrl_attached is not None:
                     zip_path = xbrl_attached.download(path=path)
                     folder_path = unzip(zip_path['full_path'])
                     file = search_file(folder_path)
                     if len(file) > 0:
                         self._xbrl = get_xbrl_from_file(file[0])
                 else:
                     self._xbrl = None
     return self._xbrl
Esempio n. 2
0
 def xbrl(self):
     """ XBRL 데이터 반환"""
     import tempfile
     if self._xbrl is None:
         xbrl = self._get_xbrl()
         if xbrl:
             xbrl_list = []
             with tempfile.TemporaryDirectory() as path:
                 file_path = xbrl.download(path)
                 extract_path = unzip(file_path)
                 xbrl_file = search_file(extract_path)
                 for file in xbrl_file:
                     xbrl = get_xbrl_from_file(file)
                     xbrl_list.append(xbrl)
             self._xbrl = xbrl_list[0]
     return self._xbrl