Exemplo n.º 1
0
def dart_find_by_name(crp_nm):
    global crp_list
    if crp_list is None:
        crp_list = dart.get_crp_list()

    found_crp = crp_list.find_by_name(crp_nm)
    return data_encode('success', found_crp)
Exemplo n.º 2
0
def dart_download_file(data):
    global crp_list
    if crp_list is None:
        crp_list = dart.get_crp_list()

    crp_cd_list = data.get('crp_cd_list', '0')
    separate = data.get('separate', 'false')
    if separate == 'false':
        separate = False
    else:
        separate = True
    start_dt = data.get('start_dt', '20180101')
    end_dt = data.get('end_dt')
    report_tp = data.get('report_tp', 'annual')
    path = data.get('path')

    crps = [crp_list.find_by_crp_cd(crp_cd) for crp_cd in crp_cd_list]
    crps = [crp for crp in crps if crp]

    if not crps:
        return data_encode('error')
    for crp in crps:
        dart_save_file(crp, path, start_dt, end_dt, report_tp, separate)
    return data_encode('success', crps)
Exemplo n.º 3
0
def dart_get_crp_list(_):
    global crp_list
    crp_list = dart.get_crp_list()
    return data_encode('success', crp_list)
Exemplo n.º 4
0
    except ValueError:
        asn_api = prompt(qst_api)
        api_key = asn_api['key']
        api_key = api_key.strip()
        dart.dart_set_api_key(api_key)


if __name__ == '__main__':
    if sys.platform.startswith('win'):
        # On Windows calling this function is necessary.
        mp.freeze_support()
    print(welcome)
    print('by Sungwoo Jo')
    spinner = Halo(text='Loading', spinner='dots')
    spinner.start()
    crp_list = dart.get_crp_list()
    spinner.stop()

    check_api_key()

    ans = prompt(qst_nm)
    crp_nm = ans['crp_nm']
    crp_list = crp_list.find_by_name(crp_nm)

    if not crp_list:
        print('Can not find company!')
        exit(1)

    qst_crp_list = {crp.crp_nm: crp for crp in crp_list}
    qst_crp_nm_list = list(qst_crp_list.keys())