Skip to main content

planet-terp

a python client for the planet terp api.

installation

uv add planet-terp-client

usage

get a course

from planet_terp import PlanetTerp

client = PlanetTerp()

course = client.course("CMSC320")
print(course.title)

get a professor

professor = client.professor("Clyde Kruskal")
print(professor.average_rating)
# 2.75

search

results = client.search("CMSC320")
for result in results:
    print(result.name)

get grades

grades = client.grades(course="CMSC351", semester="202308")
for grade in grades:
    print(f"{grade.section}: {grade.professor}")

check if instructor is ta or professor

from planet_terp import TA

professors = client.professors(limit=10)
for p in professors:
    if isinstance(p, TA):
        print(f"{p.name} is a ta")
    else:
        print(f"{p.name} is a professor")

advanced examples

get average rating of all professors for a course

course = client.course("CMSC330")
for name in course.professors:
    try:
        p = client.professor(name)
        if p.average_rating:
            print(f"{p.name}: {p.average_rating}")
    except:
        print(f"could not fetch {name}")

calculate pass rate for a course

grades = client.grades(course="CMSC351")
total_students = 0
passed_students = 0

for g in grades:
    section_total = (g.A_plus + g.A + g.A_minus + 
                   g.B_plus + g.B + g.B_minus + 
                   g.C_plus + g.C + g.C_minus + 
                   g.D_plus + g.D + g.D_minus + 
                   g.F + g.W + g.Other)
    
    # assuming C- or better is passing for major reqs
    section_pass = (g.A_plus + g.A + g.A_minus + 
                  g.B_plus + g.B + g.B_minus + 
                  g.C_plus + g.C + g.C_minus)
    
    total_students += section_total
    passed_students += section_pass

if total_students > 0:
    print(f"pass rate: {(passed_students/total_students)*100:.2f}%")

Release files for planet-terp-client 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for planet-terp-client 0.1.6
File Size Uploaded
planet_terp_client-0.1.6.tar.gz 21.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for planet-terp-client 0.1.6
File Interpreter ABI Platform
planet_terp_client-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 27.5 kB

Release files / planet_terp_client-0.1.6.tar.gz

Download URL planet_terp_client-0.1.6.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bf2626975dbbbe72b94a111e1517bc73de62046f9e427db66cff39260932c21a
BLAKE2b-256 checksum
How to use checksums
647377678c9a576b125f91a0855e4bf0d09ddced2006016daaaee54d6f4a3c60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release files / planet_terp_client-0.1.6-py3-none-any.whl

Download URL planet_terp_client-0.1.6-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d03a0907b98fd72fee5b470fefe48126d1847023b55757a913ffb9cbd7f7f496
BLAKE2b-256 checksum
How to use checksums
958b745e12228a4bf9a4ccfb4a3772df9e07be20fdaa76c5575ecbdbb7956065
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.13

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page