Registry / devops / harness-python-sdk

harness-python-sdk

JSON →
library1.0.5pypypiunverified

harness-python-sdk is the official Python SDK for programmatic interaction with Harness services. It provides a convenient client to automate tasks, manage resources, and integrate Harness functionality into other applications. The current version is 1.0.5, and it appears to have an infrequent release cadence, focusing on stability.

pip install harness-python-sdk
INSTALL
IMPORT
SIG · HARNESS-PYTHON-SDK
H
harness-python-sdk
devopspythonv1.0.5
Install
6.2s avg
Import
Disk
155MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.5 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 153.5MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 6.2s · import 0.000s · 154MB
155MB installed
● package 155MB
Code
Verified usage

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

HarnessClient
from harness_python_sdk import HarnessClient
from harness_python_sdk import HarnessClient

This quickstart demonstrates how to initialize the `HarnessClient` using API key and account ID, preferably loaded from environment variables for security. It then attempts to access a sub-service (PlatformService) to verify connection, catching potential initialization or API errors.

import os from harness_python_sdk.client import HarnessClient # Securely load credentials from environment variables ACCOUNT_ID = os.environ.get('HARNESS_ACCOUNT_ID', 'your_account_id') API_KEY = os.environ.get('HARNESS_API_KEY', 'your_api_key') if not ACCOUNT_ID or not API_KEY: print("Please set HARNESS_ACCOUNT_ID and HARNESS_API_KEY environment variables or replace placeholders.") else: try: # Initialize the Harness Client client = HarnessClient(account_id=ACCOUNT_ID, api_key=API_KEY) print(f"Harness Client initialized for Account ID: {ACCOUNT_ID}") # Example: Try to access a service (e.g., PlatformService) # This will raise an exception if credentials are bad or API is unreachable platform_service = client.platform # In a real scenario, you'd call a method on platform_service, e.g., list users print("Successfully accessed platform service. Connection appears valid.") except Exception as e: print(f"An error occurred during client initialization or API access: {e}")
Debug
Known issues
gotchaAlways handle Harness API Key and Account ID securely. Do not hardcode them directly in your source code, especially in production environments.
fix
Use environment variables (`os.environ.get`), a secrets management system (e.g., Vault, AWS Secrets Manager), or a configuration file that is not committed to version control.
affects: All versions
gotchaThe `HarnessClient` and other service objects (e.g., `PlatformService`) are nested within submodules. Incorrect import paths are a common source of `AttributeError` or `ModuleNotFoundError`.
fix
Ensure you import from the correct submodule, e.g., `from harness_python_sdk.client import HarnessClient` and `from harness_python_sdk.services.platform import PlatformService`.
affects: All versions
gotchaAPI calls can fail due to network issues, invalid input, or server errors. The SDK raises `harness_python_sdk.exceptions.APIError` for most API-specific errors.
fix
Wrap your API calls in `try...except harness_python_sdk.exceptions.APIError as e:` blocks to gracefully handle and inspect API-returned error messages and codes.
affects: All versions
Upgrade
Version history
1.0.5latest on PyPI · released Jun 13, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
25 hits · last 30 days
node
22
Resources
harness-python-sdk — pip install harness-python-sdk · libregistry