Skip to content
Data > Clients



The python library files are available upon request - please contact to receive the latest version of the library.
This library requires the chardet library, and it can be installed via pip: pip install chardet.


The python library provides an interface identical to Java and can be easily configured.

Example - Python Code

from com.f1.ami.client import AmiClient
from com.f1.ami.listener import AmiClientListenerInterface
from com.f1.utils.options import Options

class TestClient(AmiClientListenerInterface):
    "A script demonstrating how this client can be used to connect to AMI"
    def __init__(self) -> None:

        ad = AmiClient()
        options = Options.ENABLE_SEND_SEQNUM + Options.ENABLE_SEND_TIMESTAMPS

        # ad.setDebugMessages()

        # Connecting to the AMI instance, replace with appropriate connection parameters
        ad.start("", 3289, "demo", options)

        # Sending a row of data to the table 'Sample'
        ad.addMessageParamString("Symbol", "GBP")
        ad.addMessageParamFloat("Quantity", 11.0)

        # print(ad.getOutputBuffer())


    def onMessageSent(self, client: AmiClient, message: str):
        print("msg:" + message)

    def onConnect(self, client: AmiClient):
        print("Connected to server!")

    def onDisconnect(self, client: AmiClient):
        print("Disconnected from server!")

    def onLoggedIn(self, client: AmiClient):
        print("Logged in to AMI!")

    def onMessageReceived(self, client: AmiClient, now, seqnum, status, message: str):
        print(f"Message received from server '{message}' at {now} with sequence number {seqnum} and status {status}")

test = TestClient()