Skip to main content

a python client for the planet terp api

Project description

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}%")

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

planet_terp_client-0.1.3.tar.gz (15.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

planet_terp_client-0.1.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file planet_terp_client-0.1.3.tar.gz.

File metadata

  • Download URL: planet_terp_client-0.1.3.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for planet_terp_client-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8224fd8c661a2f2d2a4c8c065005c0a55309061ae31bb7eea8571c565c0bcd1d
MD5 145c2b0728c15d7fa22a44873720028d
BLAKE2b-256 3e4086080804b8c3add2a5dc0b862586648910f4b5378b4ea98aded9b32eafd9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for planet_terp_client-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4dc14fda34b20f0fa5e2bae8f7580caecb64ba339eb38e984b5c0eef8ac46ab2
MD5 511a131bca030bf67c56d9f8f0c5cfcb
BLAKE2b-256 0e965ed48390528b0219ef6ed5a311bb3869d4e686e233a0ead86a6b7f91acf7

See more details on using hashes here.

Supported by

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