API Reference
Client
Models
- class pyrmp.models.Teacher(id: str, legacy_id: int | None = None, first_name: str | None = None, last_name: str | None = None, department: str | None = None, department_id: int | None = None, school: School | None = None, avg_rating: float | None = None, avg_difficulty: float | None = None, num_ratings: int | None = None, would_take_again_percent: float | None = None, ratings_distribution: Dict[str, Any] | None = None, course_codes: List[str] | None = None, lock_status: str | None = None, is_saved: bool | None = None, _client: Any | None = None)[source]
A teacher/professor on RateMyProfessor.
This is the main object you’ll work with when searching for or getting details about professors.
Usage:
# Search for teachers results = client.search_teachers("John Smith") teacher = results.items[0] print(teacher.full_name) # "John Smith" print(teacher.avg_rating) # 4.5 print(teacher.num_ratings) # 100 print(teacher.department) # "Computer Science" # Teacher's school info if teacher.school: print(teacher.school.name) # "Stanford University" # Get more details (ORM method) details = teacher.get_details() print(details.would_take_again_percent) # 80.0 print(details.avg_difficulty) # 3.0 # Get ratings (ORM method) ratings = teacher.get_ratings(count=10) for rating in ratings.items: print(rating.clarity_rating, rating.comment)
- id
Unique identifier for this teacher (used in API calls).
- Type:
str
- legacy_id
Original numeric ID from older RMP system.
- Type:
int | None
- first_name
Teacher’s first name.
- Type:
str | None
- last_name
Teacher’s last name.
- Type:
str | None
- department
Department the teacher belongs to (e.g., “Computer Science”).
- Type:
str | None
- department_id
Numeric department identifier.
- Type:
int | None
- school
The school this teacher is associated with.
- Type:
pyrmp.models.School | None
- avg_rating
Average rating from students (0.0-5.0).
- Type:
float | None
- avg_difficulty
Average difficulty rating (0.0-5.0).
- Type:
float | None
- num_ratings
Total number of ratings received.
- Type:
int | None
- would_take_again_percent
Percentage of students who would take again.
- Type:
float | None
- ratings_distribution
Breakdown of rating distribution (dict with r1-r5).
- Type:
Dict[str, Any] | None
- course_codes
List of course codes taught by this teacher.
- Type:
List[str] | None
- lock_status
Whether the professor’s page is locked.
- Type:
str | None
- is_saved
Whether the professor is saved by the current user.
- Type:
bool | None
- property full_name: str | None
Get the teacher’s full name.
Returns the first and last name combined, or None if either is missing. Useful for display purposes.
- Returns:
“John Smith” if both names exist, None otherwise.
Example:
teacher = Teacher(id="1", first_name="John", last_name="Smith") print(teacher.full_name) # "John Smith" teacher2 = Teacher(id="2", first_name="John") print(teacher2.full_name) # None
- get_details()[source]
Get full details for this teacher.
- Returns:
Teacher object with all fields populated.
- Raises:
RateMyProfessorError – If no client is associated with this teacher.
Example:
results = client.search_teachers("John Smith") teacher = results.items[0] details = teacher.get_details() print(details.would_take_again_percent)
- get_ratings(count: int = 20, course_filter: str | None = None)[source]
Get ratings for this teacher.
- Parameters:
count – How many ratings (1-100). Defaults to 20.
course_filter – Only get ratings for a specific course (e.g., “CS101”).
- Returns:
PaginatedResult with Rating objects.
- Raises:
RateMyProfessorError – If no client is associated with this teacher.
Example:
results = client.search_teachers("John Smith") teacher = results.items[0] ratings = teacher.get_ratings(count=10) for rating in ratings.items: print(rating.clarity_rating, rating.comment)
- class pyrmp.models.School(id: str, legacy_id: int | None = None, name: str | None = None, city: str | None = None, state: str | None = None, country: str | None = None, num_ratings: int | None = None, avg_rating: float | None = None, avg_rating_rounded: float | None = None, departments: List[Dict[str, Any]] | None = None, summary: Dict[str, Any] | None = None, _client: Any | None = None)[source]
A school or university on RateMyProfessor.
You’ll get School objects when searching for schools or when a teacher is associated with a school.
Usage:
school = client.get_school_details("Teacher-123") print(school.name) # "Stanford University" print(school.num_ratings) # 5000 print(school.avg_rating) # 4.2 # When searching results = client.search_schools("MIT") for school in results.items: print(school.name, school.city, school.state) # Get ratings (ORM method) ratings = school.get_ratings(count=10) for rating in ratings.items: print(rating.facilities_rating, rating.comment) # Get details (ORM method) details = school.get_details()
- id
Unique identifier for this school (used in API calls).
- Type:
str
- legacy_id
Original numeric ID from older RMP system.
- Type:
int | None
- name
Full school name (e.g., “Stanford University”).
- Type:
str | None
- city
City where the school is located.
- Type:
str | None
- state
State abbreviation (e.g., “CA”).
- Type:
str | None
- country
Country of the school.
- Type:
str | None
- num_ratings
Total number of ratings this school has received.
- Type:
int | None
- avg_rating
Average overall school rating (0.0-5.0).
- Type:
float | None
- avg_rating_rounded
Average rating rounded to nearest 0.5.
- Type:
float | None
- departments
List of departments at the school.
- Type:
List[Dict[str, Any]] | None
- summary
Detailed ratings for various school aspects.
- Type:
Dict[str, Any] | None
- get_details()[source]
Get full details for this school.
- Returns:
School object with all fields populated.
Example:
results = client.search_schools("MIT") school = results.items[0] details = school.get_details() print(details.num_ratings)
- get_ratings(count: int = 20)[source]
Get ratings for this school.
- Parameters:
count – How many ratings (1-100). Defaults to 20.
- Returns:
PaginatedResult with SchoolRating objects.
Example:
results = client.search_schools("MIT") school = results.items[0] ratings = school.get_ratings(count=10) for rating in ratings.items: print(rating.facilities_rating, rating.comment)
- class pyrmp.models.Rating(id: str, legacy_id: int | None = None, teacher: Teacher | None = None, comment: str | None = None, helpful_rating: float | None = None, clarity_rating: float | None = None, difficulty_rating: float | None = None, grade: str | None = None, class_name: str | None = None, would_take_again: bool | None = None, is_for_credit: bool | None = None, textbook_used: bool | None = None, attendance_mandatory: bool | None = None, is_for_online_class: bool | None = None, rating_tags: List[str] | None = None, thumbs_up_total: int | None = None, thumbs_down_total: int | None = None, date: str | datetime | None = None, flag_status: str | None = None, created_by_user: bool | None = None)[source]
An individual teacher rating/review from a student.
Ratings come from client.get_teacher_ratings() or client.get_rating_details().
Usage:
ratings = client.get_teacher_ratings(teacher_id, count=10) for rating in ratings.items: print(f"Rating: {rating.clarity_rating}/5") print(f"Difficulty: {rating.difficulty_rating}/5") print(f"Grade: {rating.grade}") print(f"Class: {rating.class_name}") print(f"Comment: {rating.comment}") print(f"Would take again: {rating.would_take_again}") print(f"Helpful votes: {rating.thumbs_up_total}") print("---")
- id
Unique identifier for this rating.
- Type:
str
- legacy_id
Original numeric ID from older RMP system.
- Type:
int | None
- teacher
The teacher this rating is for (if available).
- Type:
pyrmp.models.Teacher | None
- comment
The written review text from the student.
- Type:
str | None
- helpful_rating
Helpfulness rating (1-5, where 5 is most helpful).
- Type:
float | None
- clarity_rating
Clarity rating (1-5, where 5 is most clear).
- Type:
float | None
- difficulty_rating
Difficulty rating (1-5, where 5 is most difficult).
- Type:
float | None
- grade
Grade received in the class (e.g., “A”, “B+”, “Pass”).
- Type:
str | None
- class_name
Name of the class rated (e.g., “CS101”).
- Type:
str | None
- would_take_again
Whether the student would take the teacher again.
- Type:
bool | None
- is_for_credit
Whether the class was taken for credit.
- Type:
bool | None
- textbook_used
Whether a textbook was used in the class.
- Type:
bool | None
- attendance_mandatory
Whether attendance was mandatory.
- Type:
bool | None
- is_for_online_class
Whether this was for an online class.
- Type:
bool | None
- rating_tags
List of tags describing the rating (e.g., [“amazing lectures”]).
- Type:
List[str] | None
- thumbs_up_total
Number of “helpful” votes this rating received.
- Type:
int | None
- thumbs_down_total
Number of “unhelpful” votes this rating received.
- Type:
int | None
- date
Date the rating was posted (string or datetime).
- Type:
str | datetime.datetime | None
- flag_status
Whether the rating has been flagged for review.
- Type:
str | None
- created_by_user
Whether this rating was created by the current user.
- Type:
bool | None
- class pyrmp.models.SchoolRating(id: str, legacy_id: int | None = None, school: School | None = None, comment: str | None = None, clubs_rating: float | None = None, facilities_rating: float | None = None, food_rating: float | None = None, happiness_rating: float | None = None, internet_rating: float | None = None, location_rating: float | None = None, opportunities_rating: float | None = None, reputation_rating: float | None = None, safety_rating: float | None = None, social_rating: float | None = None, date: str | datetime | None = None, thumbs_up_total: int | None = None, thumbs_down_total: int | None = None, flag_status: str | None = None, created_by_user: bool | None = None)[source]
A rating/review for an entire school (not a teacher).
School ratings come from client.get_school_ratings() or client.get_rating_details().
Usage:
ratings = client.get_school_ratings(school_id, count=10) for rating in ratings.items: print(f"Facilities: {rating.facilities_rating}/5") print(f"Food: {rating.food_rating}/5") print(f"Social: {rating.social_rating}/5") print(f"Comment: {rating.comment}") print("---")
- id
Unique identifier for this school rating.
- Type:
str
- legacy_id
Original numeric ID from older RMP system.
- Type:
int | None
- school
The school this rating is for (if available).
- Type:
pyrmp.models.School | None
- comment
The written review text from the student.
- Type:
str | None
- clubs_rating
Rating for clubs and activities (1-5).
- Type:
float | None
- facilities_rating
Rating for facilities (1-5).
- Type:
float | None
- food_rating
Rating for food quality (1-5).
- Type:
float | None
- happiness_rating
Overall happiness rating (1-5).
- Type:
float | None
- internet_rating
Rating for internet speed (1-5).
- Type:
float | None
- location_rating
Rating for campus location (1-5).
- Type:
float | None
- opportunities_rating
Rating for opportunities (1-5).
- Type:
float | None
- reputation_rating
Rating for school reputation (1-5).
- Type:
float | None
- safety_rating
Rating for campus safety (1-5).
- Type:
float | None
- social_rating
Rating for social activities (1-5).
- Type:
float | None
- date
Date the rating was posted.
- Type:
str | datetime.datetime | None
- thumbs_up_total
Number of helpful votes.
- Type:
int | None
- thumbs_down_total
Number of unhelpful votes.
- Type:
int | None
- flag_status
Whether the rating has been flagged.
- Type:
str | None
- created_by_user
Whether this was created by the current user.
- Type:
bool | None
- class pyrmp.models.PaginatedResult(items: List[Any], has_next_page: bool, end_cursor: str | None = None, total_count: int | None = None)[source]
A page of results from a search or listing operation.
All search and listing methods return this wrapper. Use items to access the actual Teacher/School/Rating objects, and has_next_page/end_cursor for pagination.
Usage:
# Get first page results = client.search_teachers("Smith", count=10) print(len(results)) # Number of items in this page print(bool(results)) # True if any items for teacher in results.items: print(teacher.full_name) # Get next page if results.has_next_page: next_page = client.search_teachers("Smith", count=10) # ... handle next_page
- items
List of items in the current page (Teacher, School, or Rating objects).
- Type:
List[Any]
- has_next_page
Whether there are more pages available after this one.
- Type:
bool
- end_cursor
Cursor string to use for fetching the next page.
- Type:
str | None
- total_count
Total number of items across all pages (if available).
- Type:
int | None