示例#1
0
def scrape_submissions_for_task(task_id, count=1000):
    contest_id = task_id.split('/')[0]

    id_from = 1
    found = True
    while found:
        found = False

        response = _api_get('contest.status',
                            kwargs={
                                'contestId': contest_id,
                                'from': id_from,
                                'count': count,
                            })

        for submission_data in response:
            found = True

            check_task_id = '/'.join([
                str(submission_data['problem']['contestId']),
                submission_data['problem']['index']
            ])

            if task_id.lower() != check_task_id.lower():
                continue

            for submission in parse_submission(submission_data):
                yield submission
        id_from += count
示例#2
0
def scrape_recent_submissions(count=1000):
    response = _api_get('problemset.recentStatus', kwargs={
        'count': count,
    })
    for submission_data in response:
        for submission in parse_submission(submission_data):
            yield submission
示例#3
0
def scrape_submissions_for_user(handle, count=200):
    id_from = 1
    found = True
    while found:
        found = False

        response = _api_get('user.status',
                            kwargs={
                                'handle': handle,
                                'from': id_from,
                                'count': count,
                            })

        for submission_data in response:
            found = True

            for submission in parse_submission(submission_data):
                if submission['author_id'] == handle.lower():
                    yield submission

        id_from += count