Veracode API Python Library

0.9.65 · active · verified Fri Apr 17

This is an officially supported Python helper library for interacting with the Veracode APIs, primarily focusing on the modern REST APIs. It simplifies API calls by handling authentication, retries, pagination, and provides higher-level abstractions for common Veracode functions. The library is currently at version `0.9.65` and receives frequent updates for bug fixes and new feature support.

Common errors

Warnings

Install

Imports

Quickstart

This example demonstrates how to initialize the `Applications` client and retrieve a list of your Veracode applications. It expects your Veracode API Key ID and Secret to be set as environment variables `VERACODE_API_KEY_ID` and `VERACODE_API_KEY_SECRET` respectively. It includes a basic check for these variables.

import os
from veracode.applications import Applications

# Ensure Veracode API credentials are set as environment variables
# VERACODE_API_KEY_ID and VERACODE_API_KEY_SECRET
api_key_id = os.environ.get('VERACODE_API_KEY_ID', '')
api_key_secret = os.environ.get('VERACODE_API_KEY_SECRET', '')

if not api_key_id or not api_key_secret:
    print("WARNING: Veracode API credentials not found in environment variables.")
    print("Please set VERACODE_API_KEY_ID and VERACODE_API_KEY_SECRET.")
else:
    try:
        # Initialize the Applications client
        apps = Applications()

        # Get the first 10 applications
        all_applications = apps.get_all(size=10)

        if all_applications:
            print(f"Found {len(all_applications)} applications:")
            for app in all_applications:
                print(f"  - {app.get('name')} (ID: {app.get('id')})")
        else:
            print("No applications found or accessible.")
    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →