import blpapi
import json
import pandas as pd
from tabulate import tabulate


def main():
    # Setup connection to NAME_1 servers
    options = blpapi.SessionOptions()
    options.setServerHost("localhost")
    options.setServerPort(8194)

    # Create and start session
    session = blpapi.Session(options)
    session.start()

    # Open and get service
    session.openService("//blp/cmp")
    service = session.getService("//blp/cmp")

    # Request is a JSON object
    request = {        
        "security": "JPMAC 2007-CH3 M2", 
        "input_value": 100, 
        "prepay_rate": "100BTM", 
        "rate_type": "forward",
        "operation": "Analytics; OAS"
}

    # Send request
    response = make_request(request, service, session)

    print(json.dumps(response, indent=4))
    
     # Print response in tabular format
    headers = [x for x in response.keys()]
    table_data = [response[x] for x in response.keys()]
    df = pd.DataFrame(data, columns=headers)
    
    # Print response in tabular format
    print(tabulate(table_data, headers, tablefmt="pretty"))

    # Close session
    session.stop()


def make_request(request_json, service, session):
    """Format request and send"""
    # Form request into name/value objects
    request_body = {
        "cmpExcelRequest": {
            "parameters": [{"name": x, "value": str(request_json[x])} for x in request_json],
        }
    }
    # Send request
    request = service.createRequest("request")
    request.getElement("cmpJsonRequest").setElement("requestData", json.dumps(request_body))
    response = get_response(request, session)

    # Get response
    if response.hasElement("cmpJsonResponse"):
        return json.loads(response.getElement("cmpJsonResponse").getElement("responseData").getValueAsString())
    else:
        return response


def get_response(request, session):
    """Send request and wait for response"""
    session.sendRequest(request)

    # Loop through all events until response or failure
    continue_loop = True

    while continue_loop:
        event = session.nextEvent(1000)
        event_type = event.eventType()

        for msg in event:
            if event_type == blpapi.Event.RESPONSE:
                response = msg
                continue_loop = False
            elif msg.messageType() == "RequestFailure":
                response = None
                continue_loop = False

    return response


if __name__ == "__main__":
    main() Your entire response should be in English, and in all capital letters.
user