Skip to main content

This is a non-official package that leverages the Harness API using Python.

Project description

Harness Python SDK

Welcome to the Harness Python SDK! This SDK provides a convenient way to interact with the Harness platform's APIs using Python.

Prerequisites

Before using the SDK, ensure you have the following:

  • Harness Platform API Key: You'll need an API key to authenticate with the Harness API. You can create a personal API key.
  • Python 3 or higher: This SDK requires Python 3 or higher to run.
  • Account Identifier: The account identifier is required for authenticating with the Harness API. You can find this identifier in the URL when you're logged into your Harness account. For example, in the URL https://app.harness.io/ng/account/Fak3Acc0unt1D/settings/overview, the account identifier is Fak3Acc0unt1D.

Make sure you have installed the required libraries using the following commands:

pip install requests pyyaml
  • requests: This library is required for making HTTP requests to the Harness platform.
  • pyyaml: This library is necessary for handling YAML files, which may be required by the script for configuration or data manipulation.

Getting Started

To get started with the SDK, you'll need to authenticate with the Harness API. Here's how you can do it:

import os
from harness_sdk import HarnessBaseService

harness_service = HarnessBaseService(os.environ.get('HARNESS_PLATFORM_API_KEY'), "my-account-identifier")

Example 1 - Listing Services

Use the following code to list all services:

harness_service.services.fetch_services()

Example 2 - Listing Connectors using the old API

To list connectors using the old API, use the following code:

harness_service.connectors.old.fetch_connectors_listV2(
    data={
        "types": ["HttpHelmRepo"],
        "filterType": "Connector"
    },
    org_identifier=org_identifier,
    project_identifier=project_identifier
)

Reference

Here's a reference to the available classes in the SDK:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harness_py_sdk-0.0.7.tar.gz (114.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harness_py_sdk-0.0.7-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file harness_py_sdk-0.0.7.tar.gz.

File metadata

  • Download URL: harness_py_sdk-0.0.7.tar.gz
  • Upload date:
  • Size: 114.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for harness_py_sdk-0.0.7.tar.gz
Algorithm Hash digest
SHA256 30b179e571ee5e21960ecbed84c2f615d754fec9de172919f333890248879467
MD5 a94b5a53bf218c22cb450767a585e259
BLAKE2b-256 c787c5fdb92241ee7d4bd09d1ad36b0be49f905f61beac1419f4fed52a5a0645

See more details on using hashes here.

File details

Details for the file harness_py_sdk-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: harness_py_sdk-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.6

File hashes

Hashes for harness_py_sdk-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 a5ab84d588f49f52dcb2018ab817ba769680b3512f93adfbf8725565ed826d07
MD5 797183f0d014e47a6694d7bbecff1c3b
BLAKE2b-256 ba9c05093862c6765978d2720bce436f5c6bc26e71f451c6422c1f8d87b7eed9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page