import requests


def GET_SECTION(section_name):
    """Make response to database and clean it

    Arguments:
        section_name {string} -- name of the section to select from locations dict

    Returns:
        object -- response from request to section
    """

    locations = {
        "calendarEvents": "/calendar/tday-events",
        "fieldInfo": "/field-information",
        "scores": "/scores",
        "footballFieldInfo": "/field-information/field-status/football-field",
        "gymInfo": "/field-information/field-status/gym",
        "softballFieldInfo": "/field-information/field-status/softball-field"
    }

    full_url = "https://ghs-app-5a0ba.firebaseio.com" + \
        locations[section_name] + ".json"
    headers = {
        "Content-Type": "application/json"
    }
    response = requests.get(full_url, headers=headers)
    json_response = response.json()
    if json_response == None:
        return {}
    else:
        return json_response