コード例 #1
0
def field_page(level: str, field: str) -> Tuple[str, str]:
    """


    :param level:
    :param field:
    :return:
    """
    url = field_url(level, field)
    content = get_content(url)
    return content, url
コード例 #2
0
def program_catalogue_data(
        src: Optional[str] = None) -> Dict[str, Dict[str, str]]:
    """
    Academic fields grouped by program level, each having one or more
    academic program which can be retrieved with `get_programs`.
    """
    # @todo: move key params into function signature (see `field.py`)
    if src is None:
        src = URL_USASK_PROGRAMS_LIST
    else:
        src = str(src)
    content = get_content(src)
    return parse_fields(content, src)
コード例 #3
0
def program_page(program: str, field: str, level: str) -> str:
    """
    For given program, return the content of the program's page in the
    course catalogue. Lookup is done on data returned by sibling methods
    until a match is found, or the search is exhausted.

    :param program: Program name
    :param field: Field of study
    :param level: Level of study (Undergraduate, Graduate, Non-degree)
    :return: HTML content from first found page
    """
    # FIXME circular import!
    program_page_url = program_url(field, level, program)
    content = get_content(program_page_url)
    return content
コード例 #4
0
def step_impl(context):
    base_href = URL_USASK_PROGRAMS_LIST
    from devvyn.fetch import get_content
    content = get_content(base_href)
    assert locals()
コード例 #5
0
def get_course(course_code: str) -> dict:
    url = get_course_url(course_code)
    content = get_content(url)
    return parse_course(content)