src/schoology-extractor/data_generation/sections.py
def load_sections(
    request_client: RequestClient, course_id: str, sections: List[Dict]
) -> List[Dict]:
    """
    Load a list of sections for a course via the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    course_id : str
        The Schoolgy internal course id the sections are to be associated with
    sections: List[Dict]
        A list of JSON-like section objects in a form suitable for submission to the
        Schoology section creation endpoint.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    """
    assert (
        len(sections) > 0 and len(sections) < 51
    ), "Number of sections must be between 1 and 50"

    logger.info("Creating %s sections via Schoology API", len(sections))

    sections_json = {"sections": {"section": sections}}
    post_response: List[Dict] = request_client.bulk_post(
        f"courses/{course_id}/sections", sections_json
    )["section"]
    validate_multi_status(post_response)
    logger.info("Successfully created %s sections", len(post_response))

    with_schoology_response_df: DataFrame = merge(
        json_normalize(sections),
        json_normalize(post_response).drop(
            ["section_school_code", "grading_periods"], axis=1
        ),
        left_index=True,
        right_index=True,
    )

    return with_schoology_response_df.to_dict("records")

    Load a list of sections for a course via the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    course_id : str
        The Schoolgy internal course id the sections are to be associated with
    sections: List[Dict]
        A list of JSON-like section objects in a form suitable for submission to the
        Schoology section creation endpoint.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    
Load a list of sections for a course via the Schoology API.
Parameters

request_client : RequestClient
A RequestClient initialized for access to the Schoology API
course_id : str
The Schoolgy internal course id the sections are to be associated with
sections: List[Dict]
A list of JSON-like section objects in a form suitable for submission to the
Schoology section creation endpoint.

Returns

List[Dict]
A list of JSON-like section objects incorporating the response values from the
Schoology API, e.g. resource ids and status from individual POSTing
Load a list of sections for a course via the Schoology API . Parameters request_client : RequestClient A RequestClient initialized for access to the Schoology API course_id : str The Schoolgy internal course id the sections are to be associated with sections : List [ Dict ] A list of JSON - like section objects in a form suitable for submission to the Schoology section creation endpoint . Returns List [ Dict ] A list of JSON - like section objects incorporating the response values from the Schoology API e . g . resource ids and status from individual POSTing
def load_sections(
    request_client: RequestClient, course_id: str, sections: List[Dict]
) -> List[Dict]:
    assert (
        len(sections) > 0 and len(sections) < 51
    ), "Number of sections must be between 1 and 50"
    logger.info("Creating %s sections via Schoology API", len(sections))
    sections_json = {"sections": {"section": sections}}
    post_response: List[Dict] = request_client.bulk_post(
        f"courses/{course_id}/sections", sections_json
    )["section"]
    validate_multi_status(post_response)
    logger.info("Successfully created %s sections", len(post_response))
    with_schoology_response_df: DataFrame = merge(
        json_normalize(sections),
        json_normalize(post_response).drop(
            ["section_school_code", "grading_periods"], axis=1
        ),
        left_index=True,
        right_index=True,
    )
    return with_schoology_response_df.to_dict("records")
def load_sections ( request_client : RequestClient , course_id : str , sections : List [ Dict ] ) -> List [ Dict ] : assert ( len ( sections ) > 0 and len ( sections ) < 51 ) , "Number of sections must be between 1 and 50" logger . info ( "Creating %s sections via Schoology API" , len ( sections ) ) sections_json = { "sections" : { "section" : sections } } post_response : List [ Dict ] = request_client . bulk_post ( f"courses/{course_id}/sections" , sections_json ) [ "section" ] validate_multi_status ( post_response ) logger . info ( "Successfully created %s sections" , len ( post_response ) ) with_schoology_response_df : DataFrame = merge ( json_normalize ( sections ) , json_normalize ( post_response ) . drop ( [ "section_school_code" , "grading_periods" ] , axis = 1 ) , left_index = True , right_index = True , ) return with_schoology_response_df . to_dict ( "records" )
Load a list of sections for a course via the Schoology API.
Load a list of sections for a course via the Schoology API .
"""
    Load a list of sections for a course via the Schoology API.

    Parameters
    ----------
    request_client : RequestClient
        A RequestClient initialized for access to the Schoology API
    course_id : str
        The Schoolgy internal course id the sections are to be associated with
    sections: List[Dict]
        A list of JSON-like section objects in a form suitable for submission to the
        Schoology section creation endpoint.

    Returns
    -------
    List[Dict]
        A list of JSON-like section objects incorporating the response values from the
        Schoology API, e.g. resource ids and status from individual POSTing
    """
request_client
RequestClient
course_id
str
sections
List[Dict]