Skip to main content

A Python wrapper for Gradescope to easily retrieve data from your Gradescope Courses.

Project description

GRADESCOPE

A Python wrapper for Gradescope to easily retrieve data from your Gradescope Courses.

license last-commit repo-top-language repo-language-count

Overview

Gradescope is a Python package project designed to provide seamless interaction with the Gradescope service, offering functionalities such as login, fetching course and assignment information, and submission downloads. By encapsulating key entities like Courses, Assignments, and Members, Gradescope provides a structured approach for managing data in JSON and CSV formats. The project aims to simplify tasks for users by providing wrapper functions that handle data retrieving and API calls.


Installation

pip install gradescope-tool

Example Usage

from gradescope import *

gs = Gradescope('username', 'password')

courses = gs.get_courses(role=Role.INSTRUCTOR)
# courses:
# [Course(
#    course_id=123456,
#    url='/courses/123456',
#    role='instructor',
#    term='Spring 2024',
#    short_name='Math 2B',
#    full_name='Math 2B: Calculus'
# ), ...]

assignments = gs.get_assignments(courses[0])
# assignments:
# [Assignment(
#    assignment_id=654321,
#    assignment_type='assignment',
#    url='/courses/123456/assignments/654321',
#    title='Assignment 1',
#    container_id=None,
#    versioned=False,
#    version_index=None,
#    version_name=None,
#    total_points='100.0',
#    student_submission=True,
#    created_at='Apr 01',
#    release_date='2024-04-01T00:00',
#    due_date='2024-04-07T23:59',
#    hard_due_date='2024-04-10T23:59',
#    time_limit=None,
#    active_submissions=250,
#    grading_progress=100,
#    published=True,
#    regrade_requests_open=False,
#    regrade_requests_possible=True,
#    regrade_request_count=0,
#    due_or_created_at_date='2024-04-07T23:59'
# ), ...]

members = gs.get_members(courses[0])
# members:
# [Member(
#    member_id='112233',
#    full_name='Peter Anteater',
#    first_name='Peter',
#    last_name='Anteater',
#    role='0',
#    sid='1234567890',
#    email='uci.mascot@uci.edu'
# ), ...]

past_submissions = gs.get_past_submissions(courses[0], assignments[0], members[0])
# past_submissions:
# [Submission(
#    course_id=123456,
#    assignment_id=654321,
#    member_id='112233',
#    submission_id=987654321,
#    created_at='2024-04-07T12:34:56.655388-07:00',
#    score=55.55,
#    url='/courses/123456/assignments/654321/submissions/987654321'
# ), ...]

gradebook = gs.get_gradebook(courses[0], members[0])
save_json('./gradebook.json', gradebook, encoder=EnhancedJSONEncoder)

grades_csv = gs.get_assignment_grades(assignments[0])
save_csv('./assignment_grades.csv', grades_csv)

gs.download_file('./submission.zip', past_submission[-1].get_file_url())

Modules

File Summary
gradescope.py Manage interaction with Gradescope API. Provide functionality such as login; retrieving course, assignment, member, past submissions, and gradebook data; and submission downloads.
dataclass.py Defines data classes for Courses, Assignments, Members, and Submissions in Gradescope. Supports generating URLs and download links.
constants.py Defines base URLs and role mappings for Gradescope API integration.
utils.py Provide dataclasse to dictionaries encoder and functions for easy loading/saving JSON and CSV files.
errors.py Defines custom exception classes for handling different error scenarios in the Gradescope API interactions. Includes LoginError, NotLoggedInError, and ResponseError classes to manage login failures, unauthorized access, and general response issues.

Contributing

Contributions are welcome! Here are several ways you can contribute:

Contributing Guidelines
  1. Fork the Repository: Start by forking the project repository to your github account.
  2. Clone Locally: Clone the forked repository to your local machine using a git client.
    git clone https://github.com/Teaching-and-Learning-in-Computing/Gradescope
    
  3. Create a New Branch: Always work on a new branch, giving it a descriptive name.
    git checkout -b new-feature-x
    
  4. Make Your Changes: Develop and test your changes locally.
  5. Commit Your Changes: Commit with a clear message describing your updates.
    git commit -m 'Implemented new feature x.'
    
  6. Push to github: Push the changes to your forked repository.
    git push origin new-feature-x
    
  7. Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
  8. Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!

Contribution


License

This project is protected under the MIT License.


Disclaimer

By using this package, you acknowledge and agree to the following terms:

  • High Traffic Warning: This package may generate a high volume of traffic and excessive API calls to websites or services, which could affect the performance of these sites or services.

  • Potential Consequences: Misuse of this package or unintended operation can lead to circumstances such as account suspension or permanent ban from the affected websites or services.

By using this package, you agree that you are using it at your own risk. You should comply with all applicable laws and regulations, and respect the terms of service of any website or service you interact with.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gradescope-tool-0.1.3.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

gradescope_tool-0.1.3-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file gradescope-tool-0.1.3.tar.gz.

File metadata

  • Download URL: gradescope-tool-0.1.3.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.4

File hashes

Hashes for gradescope-tool-0.1.3.tar.gz
Algorithm Hash digest
SHA256 06ade8ca835b8e2e38578e8c3e2daba699148236224c710259a2a7c82bf70c06
MD5 487c26ab1601bb37b7e6613903850aaa
BLAKE2b-256 988f0557e26c36c4aea5567a425a2fa4bd0bda2e07f6b8dd0e3970ed4920ac9b

See more details on using hashes here.

File details

Details for the file gradescope_tool-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for gradescope_tool-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0c67d408e5e4c798dfabca7380820d9db0c164060b51d756e31f71051c5fa98a
MD5 97f0db497b4554b3d888161b749c721c
BLAKE2b-256 76ab30869e4cce3de5cae1da97c6fe1d891086c04330b9e32aed85f66879da63

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page