import requests


def download_index(country_code,
                   index_code,
                   start_date=1960,
                   end_date=2018):
    """
    Get a JSON response for the index data of one country.

    Args:
        country_code(str): The two letter code for the World Bank webpage
        index_code(str): The code for the index to retreive
        start_date(int): The initial year to retreive
        end_date(int): The final year to retreive

    Returns:
        str: a JSON string with the raw data
    """
    payload = {'format': 'json',
               'per_page': '500',
               'date': '{}:{}'.format(str(start_date), str(end_date))
               }
    r = requests.get(
        'http://api.worldbank.org/v2/countries/{}/indicators/{}'.format(
            country_code, index_code), params=payload)
    return r.json()