import requests


def ECG_trace_list(MRI):
    """ Get a list of patient's ECG images(except the latest one)

    Target a patient in the database by the MRI, use the 'GET' request
    for server to get that patient's all ECG image timestamps(except
    the latest one) and save them to a string.

    Args:
        int/str: A integer of medical record number, or a numeric
         string that indicates a medical record number

    Returns:
        List: A list of the timestamps corresponding to patient's
        every ECG image
    """
    r = requests.get("http://127.0.0.1:5000/api/patient_ECG_trace/" + str(MRI))
    trace_list_str = r.text[1:-2]
    trace_list = trace_list_str.split(",")
    return trace_list