Registry / auth-security / veracode-api-signing

veracode-api-signing

JSON →
library26.5.0pypypi✓ verified 86d ago

The `veracode-api-signing` library provides an easy way to sign HTTP requests destined for the Veracode API Gateway using Hash-based Message Authentication Code (HMAC). This is a crucial security measure for authenticating with Veracode's REST and XML APIs. The current version is 26.4.0, and new releases are typically published every few months.

pip install veracode-api-signing
INSTALL
IMPORT
SIG · VERACODE-API-SIGNI
V
veracode-api-signing
auth-securitypythonv26.5.0
Install
5.9s avg
Import
581ms
Disk
39MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v26.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.608s · 36.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 5.9s · import 0.553s · 37MB
39MB installed
● package 39MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RequestsAuthPluginVeracodeHMAC
from veracode_api_signing.plugin_requests import RequestsAuthPluginVeracodeHMAC
from veracode_api_signing import RequestsAuthPluginVeracodeHMAC
The authentication plugin is located within the `plugin_requests` submodule, not directly under the top-level package.

This quickstart demonstrates how to make an authenticated GET request to the Veracode REST API's `/applications` endpoint using the `veracode-api-signing` library with the popular `requests` library. API credentials are expected to be available as environment variables `VERACODE_API_KEY_ID` and `VERACODE_API_KEY_SECRET`, or alternatively, loaded from a `~/.veracode/credentials` file. The `RequestsAuthPluginVeracodeHMAC` automatically signs the request with the provided or discovered credentials.

import requests import os from veracode_api_signing.plugin_requests import RequestsAuthPluginVeracodeHMAC # Veracode API credentials can be loaded from ~/.veracode/credentials or environment variables. # For quickstart, using environment variables for demonstration. In production, prefer file. api_id = os.environ.get('VERACODE_API_KEY_ID', '') api_key_secret = os.environ.get('VERACODE_API_KEY_SECRET', '') if not api_id or not api_key_secret: print("WARNING: VERACODE_API_KEY_ID and VERACODE_API_KEY_SECRET environment variables are not set.") print("Please set them or configure ~/.veracode/credentials file for successful authentication.") # Exit or provide mock values for a non-failing example api_id = 'YOUR_MOCK_API_ID' api_key_secret = 'YOUR_MOCK_API_SECRET' # The base URL for Veracode REST APIs. For US Commercial Region. # Adjust for other regions if necessary (e.g., https://api.veracode.eu/appsec/v1) api_base = "https://api.veracode.com/appsec/v1" try: # Make a GET request to an API endpoint, e.g., /applications # The RequestsAuthPluginVeracodeHMAC automatically handles signing the request. response = requests.get(api_base + "/applications", auth=RequestsAuthPluginVeracodeHMAC(api_key_id=api_id, api_key_secret=api_key_secret)) response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx) print("Successfully fetched applications:") print(response.json()) except requests.exceptions.HTTPError as e: print(f"HTTP Error: {e.response.status_code} - {e.response.text}") except requests.exceptions.RequestException as e: print(f"An error occurred: {e}")
Debug
Known issues
breakingAs of September 2019, Veracode API authentication transitioned from username/password (basic authentication) to API ID and Key (HMAC signing) for XML APIs, and REST APIs have always required HMAC. Any code still using basic authentication will fail.
fix
Generate Veracode API credentials (API ID and Key) and update your code to use HMAC signing via this library or an equivalent method. Ensure your API ID and Key are set as environment variables or in a `~/.veracode/credentials` file.
affects: < 19.9.0 (for XML APIs), all versions for REST APIs without HMAC
gotchaVeracode API credentials should be stored in either a `~/.veracode/credentials` file or as environment variables, but not both simultaneously for the same configuration profile, as this can lead to unpredictable behavior.
fix
Choose one method for providing credentials (either the file or environment variables) and stick to it. The library will attempt to load from the file first, then environment variables. For programmatic control over multiple accounts, passing `api_key_id` and `api_key_secret` directly to the `RequestsAuthPluginVeracodeHMAC` constructor is an option.
affects: All
deprecatedThe Veracode XML Admin API was deprecated in June 2022 in favor of the Identity REST APIs, with support ending on June 30, 2023. While `veracode-api-signing` can still sign requests for XML APIs, new integrations should exclusively target the more modern REST APIs.
fix
Migrate any automation using the XML Admin API to the Identity REST APIs. Familiarize yourself with the REST API documentation for the relevant endpoints.
affects: All versions when used with XML Admin API
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'veracode_api_signing'
The `veracode-api-signing` library has not been installed in the current Python environment.
fix
pip install veracode-api-signing
VeracodeAPIError: VERACODE_API_KEY_ID and VERACODE_API_KEY_SECRET must be set
The `VeracodeHMACAuth` class requires Veracode API credentials, which were not provided directly or found in the `VERACODE_API_KEY_ID` and `VERACODE_API_KEY_SECRET` environment variables.
fix
Set the `VERACODE_API_KEY_ID` and `VERACODE_API_KEY_SECRET` environment variables, or pass the `api_key_id` and `api_key_secret` arguments directly to the `VeracodeHMACAuth` constructor.
ImportError: cannot import name 'VeracodeHMACAuth' from 'veracode_api_signing'
The `VeracodeHMACAuth` class is located within the `plugin` submodule, not directly under the top-level `veracode_api_signing` package.
fix
from veracode_api_signing.plugin import VeracodeHMACAuth
Upgrade
Version history
26.5.0latest on PyPI · released May 27, 2026
Audit
Dependencies
requestsrequiredCommonly used with `RequestsAuthPluginVeracodeHMAC` for making HTTP requests.
Agent activity
51 hits · last 30 days
node
48
OpenAI (training)
1
Resources
veracode-api-signing — pip install veracode-api-signing · libregistry