Skip to main content

Validate the Python agent configuration

The Python agent includes a script for validating and testing your agent configuration.

Steps to run the script

  1. Install contrast-agent version 5.1.0 or later using pip.

  2. Prepare your Contrast configuration using a YAML file, environment variables, or both.

  3. Run the command contrast-validate-config. This script validates your current configuration and tests your ability to communicate with Contrast.

Note

A Response: 400 Bad Request message still indicates a successful connection to Contrast.

For example, this indicates that the application Server has not yet been created in Contrast:

[contrast-validate-config] Sending test request to Contrast UI
[contrast-validate-config] Response: 400 Bad Request
[contrast-validate-config] {
 "success" : false,
 "messages" : [ "Invalid agent request" ]
}
[contrast-validate-config] 400 status code indicates success for this endpoint
[contrast-validate-config] Connection to the Contrast UI successful

And this indicates that the Server has already been created in Contrast:

[contrast-validate-config] Sending test request to Contrast UI
[contrast-validate-config] Response: 304 Not Modified
[contrast-validate-config] 304 status code indicates success for this endpoint
[contrast-validate-config] Connection to the Contrast UI successful

See also