Installation steps

  1. Install the Atatus python agent:

    Option 1: Install the agent using pip.

    copy
    icon/buttons/copy
    pip install atatus
    

    Option 2: Add atatus to your project's requirements.txt file, and install the agent using pip.

    copy
    icon/buttons/copy
    # requirements.txt
    atatus
    
    copy
    icon/buttons/copy
    pip install -r requirements.txt
    
  2. Add Atatus configuration to main.py file.

    copy
    icon/buttons/copy
    # main.py
    from fastapi import FastAPI
    import atatus
    from atatus.contrib.starlette import create_client, Atatus
    
    atatus_client = atatus.get_client()
    if atatus_client is None:
        atatus_client = create_client({
            'APP_NAME': 'FastAPI App',
            'LICENSE_KEY': 'lic_apm_xxxxxxx',
        })
    
    app = FastAPI()
    app.add_middleware(Atatus, client=atatus_client)
    
  3. Restart your FastAPI server