Пример #1
0
def main():
    init(autoreset=True)

    print Fore.GREEN + '============================================'
    print Fore.GREEN + '             Auto-Score by Soxfmr           '
    print Fore.GREEN + '              ver 0.2 20151128              '
    print Fore.GREEN + '============================================'

    try:
        username = require('Sutdent Id: ')
        password = require('Password: '******'Do you want to ignore the marked record')
        settings.IGNORE_ALREADY_SCORED = ignore

        if username == '' or password == '':
            raise Exception('Invalid input value.')

        # Retrieve the user session
        log('Preparing the user session...')
        session = login(username, password)

        # Begin
        log(Fore.GREEN + 'Session established. Getting start to marking...')
        score(session)

        log(Fore.GREEN +
            'All done! Now you should login to the education system and confirm all of record!',
            important=True)

    except Exception as e:
        print Fore.RED + e.message
Пример #2
0
def score(session):
    if not session:
        raise Exception('Invalid session for the request.')

    data = getScorePageData(session)

    if checkDone(data):
        if confirm(
                'It seem you have been finished the marking operation. Do you want to continue anyway?',
                nevigate=True):
            raise Exception('User has cancelled manually.')

    term = currentTerm(data)
    if not term:
        raise Exception('Cannot found the term from the response data.')

    t = teachers(data)
    if not t:
        raise Exception('Empty teacher list, nothing found.')

    for teacher in t:
        if teacher[
                settings.
                FIELD_TEAHCER_STATUS] == settings.RESULT_ALREADY_SCORE and settings.IGNORE_ALREADY_SCORED:
            log(Fore.YELLOW +
                'Ignore performing for teacher %s who has been marked.' %
                teacher[settings.FIELD_TEACHER_NAME])
            continue

        log('Perform the marking operation for teacher %s.' %
            teacher[settings.FIELD_TEACHER_NAME])
        mark(teacher[settings.FIELD_TEACHER_ID], term, session)
Пример #3
0
def main():
    init(autoreset = True)

    print Fore.GREEN + '============================================'
    print Fore.GREEN + '             Auto-Score by Soxfmr           '
    print Fore.GREEN + '              ver 0.2 20151128              '
    print Fore.GREEN + '============================================'

    try:
        username = require('Sutdent Id: ')
        password = require('Password: '******'Do you want to ignore the marked record')
        settings.IGNORE_ALREADY_SCORED = ignore

        if username == '' or password == '':
            raise Exception('Invalid input value.')

        # Retrieve the user session
        log('Preparing the user session...')
        session = login(username, password)

        # Begin
        log(Fore.GREEN + 'Session established. Getting start to marking...')
        score(session)

        log(Fore.GREEN + 'All done! Now you should login to the education system and confirm all of record!', important = True)

    except Exception as e:
        print Fore.RED + e.message
Пример #4
0
def score(session):
    if not session:
        raise Exception("Invalid session for the request.")

    data = getScorePageData(session)

    if checkDone(data):
        if confirm(
            "It seem you have been finished the marking operation. Do you want to continue anyway?", nevigate=True
        ):
            raise Exception("User has cancelled manually.")

    term = currentTerm(data)
    if not term:
        raise Exception("Cannot found the term from the response data.")

    t = teachers(data)
    if not t:
        raise Exception("Empty teacher list, nothing found.")

    for teacher in t:
        if teacher[settings.FIELD_TEAHCER_STATUS] == settings.RESULT_ALREADY_SCORE and settings.IGNORE_ALREADY_SCORED:
            log(
                Fore.YELLOW
                + "Ignore performing for teacher %s who has been marked." % teacher[settings.FIELD_TEACHER_NAME]
            )
            continue

        log("Perform the marking operation for teacher %s." % teacher[settings.FIELD_TEACHER_NAME])
        mark(teacher[settings.FIELD_TEACHER_ID], term, session)