Typed, retrying, rate-limited unofficial Python client for the RateMyProfessors GraphQL API.
Project description
RateMyProfessors API Client (Python)
A typed, retrying, rate-limited unofficial client for RateMyProfessors.
Disclaimer: This library is unofficial and may break if RMP changes their internal API. Use responsibly and respect rate limits.
Requirements
- Python 3.10 or later
- Works with type checkers (Pydantic models, fully typed API)
Installation
pip install ratemyprofessors-client
Available Functions
Create a client and call any of these methods. See the full docs for parameters, return types, and examples.
from rmp_client import RMPClient
with RMPClient() as client:
...
Schools
search_schools(query)— Search schools by name. Returns paginated results.get_school(school_id)— Get a single school by its numeric ID.get_compare_schools(school_id_1, school_id_2)— Fetch two schools side by side.get_school_ratings_page(school_id)— Get one page of school ratings (cached after first fetch).iter_school_ratings(school_id)— Iterator over all ratings for a school.
Professors
search_professors(query)— Search professors by name. Returns paginated results.list_professors_for_school(school_id)— List professors at a given school.iter_professors_for_school(school_id)— Iterator over all professors at a school.get_professor(professor_id)— Get a single professor by their numeric ID.get_professor_ratings_page(professor_id)— Get one page of professor ratings (cached after first fetch).iter_professor_ratings(professor_id)— Iterator over all ratings for a professor.
Low-level
raw_query(payload)— Send a raw GraphQL payload to the RMP endpoint.
Lifecycle
close()— Close the client and clear caches. Safe to call multiple times.
Errors and What They Mean
All errors extend RMPError. Catch and narrow with isinstance:
HttpError— The server returned a non-2xx status code (e.g. 404, 500).ParsingError— The response couldn't be parsed (e.g. professor/school not found).RateLimitError— The client's local rate limiter blocked the request.RetryError— The request failed after all retry attempts. Contains the last underlying error.RMPAPIError— The GraphQL API returned anerrorsarray in the response.ConfigurationError— Invalid client configuration.
from rmp_client import RMPClient, HttpError, ParsingError
with RMPClient() as client:
try:
prof = client.get_professor("2823076")
except ParsingError:
print("Professor not found")
except HttpError as e:
print(f"HTTP error: {e.status_code}")
Types
All methods return Pydantic models. Import any of these:
from rmp_client.models import (
School,
Professor,
Rating,
SchoolRating,
ProfessorSearchResult,
SchoolSearchResult,
ProfessorRatingsPage,
SchoolRatingsPage,
CompareSchoolsResult,
)
School— ID, name, location, overall quality, category ratings (reputation, safety, etc.)Professor— ID, name, department, school, overall rating, difficulty, percent take againRating— Date, comment, quality, difficulty, tags, course, thumbs up/downSchoolRating— Date, comment, overall score, category ratings, thumbs up/downProfessorSearchResult/SchoolSearchResult— Paginated list withhas_next_pageandnext_cursorProfessorRatingsPage/SchoolRatingsPage— One page of ratings with cursor paginationCompareSchoolsResult— A pair of schools
Extras
Optional helpers for data pipelines:
from rmp_client import (
analyze_sentiment,
normalize_comment,
is_valid_comment,
build_course_mapping,
clean_course_label,
)
normalize_comment(text)— Normalize text for deduplication (lowercase, collapse whitespace)is_valid_comment(text, min_len=10)— Check if a comment is non-empty and meets a minimum lengthclean_course_label(raw)— Clean scraped course labels (remove counts, normalize whitespace)build_course_mapping(scraped, valid)— Map scraped labels to known course codesanalyze_sentiment(text)— Compute sentiment label from text (uses TextBlob)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ratemyprofessors_client-2.0.0.tar.gz.
File metadata
- Download URL: ratemyprofessors_client-2.0.0.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f38455a6652609bffd29007327689a093182971fa8b4af73a30139b00bec7c7
|
|
| MD5 |
441fdd07774612b96c6825e2a6b4bdd0
|
|
| BLAKE2b-256 |
eb43667bc928e116253b75d23e3286abd677049e0c7a5a7fb96d7095a1fde7e8
|
Provenance
The following attestation bundles were made for ratemyprofessors_client-2.0.0.tar.gz:
Publisher:
publish-to-pypi.yml on amaanjaved1/Rate-My-Professors-API-Client-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratemyprofessors_client-2.0.0.tar.gz -
Subject digest:
9f38455a6652609bffd29007327689a093182971fa8b4af73a30139b00bec7c7 - Sigstore transparency entry: 1119332716
- Sigstore integration time:
-
Permalink:
amaanjaved1/Rate-My-Professors-API-Client-Python@1d7c55585441a2e596010ef4784cf22231413d4a -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/amaanjaved1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1d7c55585441a2e596010ef4784cf22231413d4a -
Trigger Event:
release
-
Statement type:
File details
Details for the file ratemyprofessors_client-2.0.0-py3-none-any.whl.
File metadata
- Download URL: ratemyprofessors_client-2.0.0-py3-none-any.whl
- Upload date:
- Size: 17.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a93316994abe8fac829000c19a3284dec331ef13a344479317739aafaa01db9
|
|
| MD5 |
7ac010729b9f71a84fc775fa07d2a1a5
|
|
| BLAKE2b-256 |
b61aaba33a6ab48c488c33d4f64095bc37d58ca54ea4818c361be22721568f4f
|
Provenance
The following attestation bundles were made for ratemyprofessors_client-2.0.0-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on amaanjaved1/Rate-My-Professors-API-Client-Python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ratemyprofessors_client-2.0.0-py3-none-any.whl -
Subject digest:
8a93316994abe8fac829000c19a3284dec331ef13a344479317739aafaa01db9 - Sigstore transparency entry: 1119332758
- Sigstore integration time:
-
Permalink:
amaanjaved1/Rate-My-Professors-API-Client-Python@1d7c55585441a2e596010ef4784cf22231413d4a -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/amaanjaved1
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@1d7c55585441a2e596010ef4784cf22231413d4a -
Trigger Event:
release
-
Statement type: