본문 바로가기

Data Science/Data Collection

[04. 금융감독원 API] 015. 사업보고서 주요정보 – 타법인 출자현황

728x90

타법인 출자현황 API 코드를 작성해보자.

 

[그림 4.15] 타법인 출자현황 개발가이드

 

import json
import pandas as pd
import requests

def get_corporate_investment(api_key, code, year, report_code):
    fullUrl = 'https://opendart.fss.or.kr/api/otrCprInvstmntSttus.json?crtfc_key=%s&corp_code=%s&' \
              'bsns_year=%s&reprt_code=%s' % (api_key, code, year, report_code)

    response = requests.get(fullUrl, headers={'User-Agent': 'Mozilla/5.0'})
    result = response.text
    result = json.loads(result)

    if result['status'] == '000':
        data = pd.DataFrame(result['list'])

        return data

if __name__ == '__main__':
    api_key ='*'
    code = '00126380'
    year = '2018'
    report_code = '11011'

    corporate_investment = get_corporate_investment(api_key, code, year, report_code)
    print(corporate_investment)


결과 값
      rcept_no     ... recent_bsns_year_fnnr_sttus_thstrm_ntpf
0  20190401004781  ...                                       -
1  20190401004781  ...                                       -
728x90