api module

Interface with the collegescorecard API.

class api.ScoreCard(API_KEY: str)

Bases: object

This is the main class used to search for colleges and their data.

Parameters:

API_KEY – The API key used to interact with college scorecards API.

get_by_id(id: int, year='latest') College

Query a college by it’s id.

Parameters:
  • id – The id of the college you want to search.

  • year (str, optional) – What year to retrieve the data from, defaults to latest availible year.

search(name: Optional[str] = None, page=0, per_page=20, year='latest', hbcu: Optional[bool] = None, size_range: list = [0, None], ownership: Optional[int] = None) List[College]

Search for a college by name.

Parameters:
  • name (str, optional) – The name of the target college

  • page (int, optional) – What page to query the data from

  • per_page (int, optional) – How many results to show per page, defaults to 20

  • year (str, optional) – What year to retrieve the data from, defaults to latest availible year

  • hbcu (bool, optional) – Filter results by whether or not it’s an HBCU

  • size_range (list, optional) – Limit results based on student population. List is structured as [min, max]

  • ownership (int, optional) – Filter based on the ownership status of the college