import requests


def api_get_course(srcdb, crn, code):
    """
    Given a CU Boulder course code and CRN, return the API response
    for details on that course (including its sections).
    """
    url = "https://classes.colorado.edu/api/?page=fose&route=details"
    data = {
        "group": "code:{}".format(code),
        "key": "crn:{}".format(crn),
        "srcdb": srcdb,
    }
    resp = requests.post(url, json=data)
    resp.raise_for_status()
    return resp.json()