Skip to main content

Python API Client for CCC

Project description

ccc_client

This package provides a simple, modular SDK for the CCC REST API.

Features

  • Automatically handles authentication and renewal
  • Graceful error management
  • Logically organized modules
  • Easily maintained

Installation

Requirements:

  • Python 3.8 or higher
  • Required packages: requests>=2.26.0, jsonschema>=4.23.0

Install using pip:

pip install cccAPI 

Install from source:

git clone https://github.hpe.com/hpe/cccAPI.git
cd cccAPI
pip install -e .

Quick Start

Initialize the Client

import json
from cccAPI import cccAPIClient
client = cccAPIClient("https://localhost:8000/cmu/v1", "root", "your-password")

Example Usage

Get Nodes

nodes = client.nodes.show_nodes()
print(json.dumps(nodes, indent=4))

Get specific Node

#Specific node named Node1
node = client.nodes.show_node("Node1")
print(json.dumps(node, indent=4))

Get specific Node/fields

  • Allowed fields are:
query_params = {"fields": "name,id,uuid,network.name,network.ipAddress,network.macAddress"}
specific_nodes=client.nodes.show_nodes(query_params)
print(json.dumps(specific_nodes, indent=4))

See examples/test.py for other test cases as implemented

API Modules

Module Description User Guide Section
nodes Node Operations: Create/Delete/Update/List Nodes, Add/Remove nodes in groups, Manage node features Section 4.5
image_groups Image Group Operations Section 4.3
network_groups Network Group Operations Section 4.4
custom_groups Custom Group Operations Section 4.2
resource_features Resource Features Management Section 4.8
image_capture_deployment Image Capture and Deployment Operations Section 4.9
power_operation Power Operations Management Section 4.10
application Application Entrypoints and Settings Section 4.1
architecture Architecture Management Section 4.11
management_cards Network Devices, Interfaces, and Routes Management Section 4.12
tasks Tasks Operations Section 4.7
conn Sessions Operations Section 4.6

Building and Publishing

Local Development

There are several ways to install the package for local development:

  1. Direct pip install:
pip install .
  1. Using pip-tools (recommended for development):
pip install pip-tools
pip-compile pyproject.toml  # Produces requirements.txt
pip install -r requirements.txt
  1. Using uv (faster installation):
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install -e . --system
  1. Building distribution packages:
pip install build
python -m build  # Creates dist/ with tar.gz and .whl

Publishing to PyPI

  1. Ensure you have the required tools:
pip install setuptools wheel twine
  1. Build the distribution:
python -m build
# Or alternatively:
# python3 setup.py sdist bdist_wheel
  1. Upload to PyPI (requires ~/.pypirc with PyPI token):
twine upload dist/*

You can verify the installation by downloading the published package:

pip install cccAPI=={version}  # Replace {version} with desired version

License

This project is license under the MIT license.

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

cccapi-0.0.12.tar.gz (21.0 kB view details)

Uploaded Source

Built Distribution

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

cccapi-0.0.12-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file cccapi-0.0.12.tar.gz.

File metadata

  • Download URL: cccapi-0.0.12.tar.gz
  • Upload date:
  • Size: 21.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cccapi-0.0.12.tar.gz
Algorithm Hash digest
SHA256 5a96d7d544f91c01df4e0ab94596a0e05a8b37b9b975ac2e826a685f2962eeaf
MD5 8581b0bc0cee2f4045e15bc206f0d539
BLAKE2b-256 e8f24dd6e92782164ca9873eafd72ab49df99cf887c968f97c154c9976d3894d

See more details on using hashes here.

File details

Details for the file cccapi-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: cccapi-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for cccapi-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 bcbfff6165d8c72e9b79c940fa47503d372df5eff84e9af2ac3230bd8486fe20
MD5 06bf2c9111449a44ce2cd97370e91259
BLAKE2b-256 d9be8379eac5e217be626d5a972a52da834df4c4b979e5cc2b9e7229a8bdc0ed

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