Python web scraper to get professor ratings from ratemyprofessor.com website.
Project description
RateMyProfessorAPI
Setup
Please note that this has only been tested on Python 3.9.1. If this doesn't work for older versions, open up an Issue. This project requires Python 3.5 or above. This WILL NOT WORK on Python 3.4 or lower.
Install the package using the following command:
python -m pip install RateMyProfessorAPI
To update the package, use the following command:
python -m pip install RateMyProfessorAPI --upgrade
To use the package in your program, please import the package:
import ratemyprofessor
Uninstallation
To uninstall the package, use the following command:
python -m pip uninstall RateMyProfessorAPI
Usage
To retrieve a list of professors, you have to first specify the school:
ratemyprofessor.get_school_by_name("School Name")
This will return None
if no school is found corresponding with that name.
Alternatively, to search for multiple schools, use
ratemyprofessor.get_schools_by_name("School Name")
This will return a list of School
s.
Using the School
object obtained from the previous commands, you can use that to find the professor:
ratemyprofessor.get_professor_by_school_and_name(school, "Professor Name")
where school refers to a School
object.
Alternatively, to search for multiple professors, use
ratemyprofessor.get_professor_by_schools_and_name(school, "Professor Name")
This will return a list of Professor
s.
Documentation
I am currently working on documentation but as of now there is no documentation yet. Sorry!
Example
import ratemyprofessor
professor = ratemyprofessor.get_professor_by_school_and_name(
ratemyprofessor.get_school_by_name("Case Western Reserve University"), "Connamacher")
if professor is not None:
print("%sworks in the %s Department of %s." % (professor.name, professor.department, professor.school.name))
print("Rating: %s / 5.0" % professor.rating)
print("Difficulty: %s / 5.0" % professor.difficulty)
print("Total Ratings: %s" % professor.num_ratings)
if professor.would_take_again is not None:
print(("Would Take Again: %s" % round(professor.would_take_again, 1)) + '%')
else:
print("Would Take Again: N/A")
Output:
Harold Connamacher works in the Computer Science Department of Case Western Reserve University.
Rating: 4.7 / 5.0
Difficulty: 3.8 / 5.0
Total Ratings: 102
Would Take Again: 86.2%
See examples
for more examples.
Acknowledgements and License
This can be seen as a continuation of the RateMyProfessorPyAPI project that can also be found on GitHub here. This serves as an inspiration for this project. This project is also licensed under the Apache 2.0 License. See LICENSE for more details.
Project details
Release history Release notifications | RSS feed
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
Hashes for RateMyProfessorAPI-1.3.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 369c4f600d8cdcf6c61d2e1e4c53e6929275302abcbf982e265ab3353afb2a3f |
|
MD5 | 4180aa48781d5ff07aa8bf273a38fae1 |
|
BLAKE2b-256 | 0524d39cbd8c25cfe7e17908346fb80afdee64cd11b8eaf510150de94783d46f |