def run():
    path_config.create_dirs(path_config.get_container_dir_path())

    popong_data_dump = fetch_popong_data_dump()
    assembly_members_data = append_additional_idxs(popong_data_dump)

    dump_file_path = path_config.get_single_file_path('assembly_members.json')

    with open(dump_file_path, 'w', encoding='utf-8') as out_file:
        json.dump(assembly_members_data, out_file, ensure_ascii=True)
    print('complete')
def run():
    path_config.create_dirs(RESULT_PATH)

    print('begin')
    member_idxs = fetch_members_idxs()
    for member_idx in member_idxs:
        print('getting assembly data, member idx: %d' % member_idx)
        recentDates = getRecentAssemblyData(member_idx)

        mAttends = refreshAttedingInfoMainMeeting(
            recentDates['main_attend'], member_idx)
        sAttends = refreshAttedingInfoSubMeeting(
            recentDates['sub_attend'], member_idx)

        updateToDateAssemblyFile(member_idx, mAttends, sAttends)
        print('complete')
    print('end')
def run():
    path_config.create_dirs(DATA_DIR)

    page_no = 1
    while True:
        sessions_ret = fetch_sessions(page_no)
        sessions = sessions_ret['sessions']

        for session in sessions:
            session_bill = session['bill']
            session_date = session['처리날짜']
            session_index = session['회차']
            session_subject = session['의안명']
            session_result = session['결과']

            dump_file_path = _get_dump_file_path(session_bill, session_date)
            if os.path.exists(dump_file_path):
                print('%s.%d skip' % (session_date, session_bill))
                continue

            print('%s.%d %s start' % (session_date, session_bill, session_subject))

            session_vote_results = fetch_session_vote_results(session_bill)

            # 추가 정보
            session_details = {
                'bill': session_bill,
                '처리날짜': session_date,
                '회차': session_index,
                '의안명': session_subject,
                '결과': session_result,
                'vote_results': session_vote_results
            }

            with open(dump_file_path, 'w', encoding='utf-8') as out_file:
                json.dump(session_details, out_file, ensure_ascii=True, sort_keys=False, indent=4)

            print('%s out' % dump_file_path)

        if sessions_ret['has_next'] is False:
            break
        page_no += 1