Registrar API Wrapper

This documentation explains the methods of the Registrar object. For the specific fields on the objects returned by these methods, see the official documentation.

Note

The Penn Data Warehouse performs nightly maintenance, which causes downtime for Penn InTouch and the Penn OpenData Registrar API. This will throw an APIError in the SDK, which client applications can catch and try to fetch the data again later.

class penn.registrar.Registrar(bearer, token)[source]

The client for the Registrar. Used to make requests to the API.

Parameters:
  • bearer – The user code for the API
  • token – The password code for the API

Usage:

>>> from penn import Registrar
>>> r = Registrar('MY_USERNAME_TOKEN', 'MY_PASSWORD_TOKEN')
course(dept, course_number)[source]

Return an object of semester-independent course info. All arguments should be strings.

>>> cis120 = r.course('cis', '120')
department(dept)[source]

Return an iterator of all course-info objects in a department, in no particular order.

search(params, validate=False)[source]

Return a generator of section objects for the given search params.

Parameters:
  • params – Dictionary of course search parameters.
  • validate – Optional. Set to true to enable request validation.
>>> cis100s = r.search({'course_id': 'cis', 'course_level_at_or_below': '200'})
search_params()[source]

Return a dictionary of possible search parameters and their possible values and descriptions.

section(dept, course_number, sect_number)[source]

Return a single section object for the given section. All arguments should be strings. Throws a ValueError if the section is not found.

>>> lgst101_bfs = r.course('lgst', '101', '301')