def handle(self, *args, **kwargs):
        if len(args) == 0:
            import time
            start_time = time.time()
            cou_codes = get_cou_codes()
            for ys in [get_config('crawler', 'semester')]:
                ACIXSTORE, auth_num = get_auth_pair(
                    'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                    '/JH/6/6.2/6.2.9/JH629001.php'
                )
                print('Crawling course for ' + ys)
                crawl_course(ACIXSTORE, auth_num, cou_codes, ys)

                ACIXSTORE, auth_num = get_auth_pair(
                    'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                    '/JH/6/6.2/6.2.3/JH623001.php'
                )
                print('Crawling dept for ' + ys)
                crawl_dept(ACIXSTORE, auth_num, cou_codes, ys)
                print('===============================\n')
            elapsed_time = time.time() - start_time
            print('Total %.3f second used.' % elapsed_time)
        if len(args) == 1:
            if args[0] == 'clear':
                Course.objects.all().delete()
                Department.objects.all().delete()
Beispiel #2
0
    def handle(self, *args, **kwargs):
        if len(args) == 0:
            # ACIXSTORE, auth_num = get_auth_pair(
            # 'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
            # '/JH/6/6.2/6.2.9/JH629001.php'
            # )
            crawl_course()

            # ACIXSTORE, auth_num = get_auth_pair(
            # 'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
            # '/JH/6/6.2/6.2.3/JH623001.php'
            # )
            # crawl_dept(ACIXSTORE, auth_num, cou_codes)
            # elapsed_time = time.time() - start_time
            # print 'Total %.3f second used.' % elapsed_time
        if len(args) == 1:
            if args[0] == 'clear':
                Course.objects.all().delete()
                Department.objects.all().delete()
Beispiel #3
0
    def handle(self, *args, **kwargs):
        if len(args) == 0:
            # ACIXSTORE, auth_num = get_auth_pair(
                # 'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                # '/JH/6/6.2/6.2.9/JH629001.php'
            # )
            crawl_course()

            # ACIXSTORE, auth_num = get_auth_pair(
                # 'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                # '/JH/6/6.2/6.2.3/JH623001.php'
            # )
            # crawl_dept(ACIXSTORE, auth_num, cou_codes)
            # elapsed_time = time.time() - start_time
            # print 'Total %.3f second used.' % elapsed_time
        if len(args) == 1:
            if args[0] == 'clear':
                Course.objects.all().delete()
                Department.objects.all().delete()
Beispiel #4
0
    def handle(self, *args, **kwargs):
        if len(args) == 0:
            import time
            start_time = time.time()
            cou_codes = get_cou_codes()
            for ys in [get_config('crawler', 'semester')]:
                ACIXSTORE, auth_num = get_auth_pair(
                    'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                    '/JH/6/6.2/6.2.9/JH629001.php')
                print('Crawling course for ' + ys)
                crawl_course(ACIXSTORE, auth_num, cou_codes, ys)

                ACIXSTORE, auth_num = get_auth_pair(
                    'https://www.ccxp.nthu.edu.tw/ccxp/INQUIRE'
                    '/JH/6/6.2/6.2.3/JH623001.php')
                print('Crawling dept for ' + ys)
                crawl_dept(ACIXSTORE, auth_num, cou_codes, ys)
                print('===============================\n')
            elapsed_time = time.time() - start_time
            print('Total %.3f second used.' % elapsed_time)
        if len(args) == 1:
            if args[0] == 'clear':
                Course.objects.all().delete()
                Department.objects.all().delete()