본문 바로가기

Data Science/Data Collection

[04. 금융감독원 API] 014. 사업보고서 주요정보 – 개인별 보수지급 금액(5억이상 상위5인)

728x90

개인별 보수지급 금액 API 코드를 작성해보자.

 

[그림 4.14] 개인별 보수지급 금액 개발가이드

 

import json
import pandas as pd
import requests

def get_individual_compensation(api_key, code, year, report_code):
    fullUrl = 'https://opendart.fss.or.kr/api/indvdlByPay.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'

    individual_compensation = get_individual_compensation(api_key, code, year, report_code)
    print(individual_compensation)


결과 값
      rcept_no    corp_cls  ...  mendng_totamt mendng_totamt_ct_incls_mendng
0  20190401004781        Y  ...  7,034,000,000                             -
1  20190401004781        Y  ...  5,996,000,000                             -
2  20190401004781        Y  ...  4,746,000,000                             -
3  20190401004781        Y  ...  4,536,000,000                             -
4  20190401004781        Y  ...  4,320,000,000                             -
728x90