Skip to main content

Official Python SDK for Nexqloud DCP (Distributed Cloud Platform)

Project description

Nexqloud DCP Python SDK

Official Python SDK for Nexqloud DCP (Distributed Cloud Platform).

This SDK provides a high-level DCPClient wrapper over the generated API client, with:

  • API key authentication via constructor or DCP_API_KEY
  • Service aliases that match the JavaScript SDK style (dc2, dks, dds, dcr, dss)
  • Configurable timeout and retries
  • Passthrough fetch(...) for authenticated low-level requests

Requirements

  • Python 3.9+
  • A Nexqloud DCP API key

Installation

Install from PyPI:

pip install nexqloud-dcp

The import path remains:

from nexqloud_dcp import DCPClient, DCPClientOptions

Local Development Setup

If you are working from this repository directly, run your scripts with src on PYTHONPATH:

PYTHONPATH=src python your_script.py

Quick Start

import os
from nexqloud_dcp import DCPClient

os.environ["DCP_API_KEY"] = "dcp_your_api_key"

client = DCPClient()

node_types = client.nodeTypes.node_types_controller_find_all()
for node_type in node_types:
    print(node_type.node_type_id, node_type.label)

Authentication

Option 1: Environment variable

export DCP_API_KEY=dcp_your_api_key
from nexqloud_dcp import DCPClient

client = DCPClient()

Option 2: Pass key directly

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(
    DCPClientOptions(api_key="dcp_your_api_key")
)

Service Clients

DCPClient exposes service aliases aligned with the TypeScript SDK naming:

  • client.dc2 -> Virtual Machines
  • client.dks -> Kubernetes Clusters
  • client.dds -> Managed Databases
  • client.dcr -> Container Registry
  • client.dss -> Object Storage
  • client.nodeTypes (or client.node_types) -> Node Types
  • client.regions -> Metadata

Usage Examples

List Virtual Machines

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(DCPClientOptions(api_key="dcp_your_api_key"))

vms = client.dc2.virtual_machines_controller_find_all()
print(vms)

List Clusters

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(DCPClientOptions(api_key="dcp_your_api_key"))

clusters = client.dks.clusters_controller_find_all(query="")
print(clusters)

List Managed Databases

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(DCPClientOptions(api_key="dcp_your_api_key"))

databases = client.dds.managed_databases_controller_list_databases(
    include_deleted="false",
    page=1,
    page_size=10,
)
print(databases)

Advanced Configuration

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(
    DCPClientOptions(
        api_key="dcp_your_api_key",
        base_url="https://gateway.dcp.nexqloud.net",
        timeout_in_seconds=60,
        max_retries=3,
    )
)

Low-Level Authenticated Requests

Use fetch(...) when you need raw HTTP behavior while still using SDK auth/retry config.

from nexqloud_dcp import DCPClient, DCPClientOptions

client = DCPClient(DCPClientOptions(api_key="dcp_your_api_key"))

response = client.fetch("/api/v1/node-types", method="GET")
response.raise_for_status()
print(response.json())

You can also pass a full URL:

response = client.fetch("https://gateway.dcp.nexqloud.net/api/v1/node-types")

Error Handling

from nexqloud_dcp import DCPClient, DCPClientOptions
from generated.errors import BadRequestError, NotFoundError

client = DCPClient(DCPClientOptions(api_key="dcp_your_api_key"))

try:
    client.dc2.virtual_machines_controller_find_one("vm-id")
except NotFoundError:
    print("VM not found")
except BadRequestError as err:
    print("Bad request:", err)

Notes

  • The generated SDK lives under src/generated.
  • The high-level wrapper lives under src/nexqloud_dcp.
  • Prefer adding custom behavior in src/nexqloud_dcp so regenerated files are not overwritten.

Contributing

See CONTRIBUTING.md for developer setup, SDK regeneration steps, and PR guidelines.

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

nexqloud_dcp-0.1.0.tar.gz (88.1 kB view details)

Uploaded Source

Built Distribution

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

nexqloud_dcp-0.1.0-py3-none-any.whl (173.3 kB view details)

Uploaded Python 3

File details

Details for the file nexqloud_dcp-0.1.0.tar.gz.

File metadata

  • Download URL: nexqloud_dcp-0.1.0.tar.gz
  • Upload date:
  • Size: 88.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nexqloud_dcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d9a242d33c59ded9eed381a55ad3eb851a975db2ee4174562913997875bc9b66
MD5 6b9cc5ecece9413a4619b5a06388d5e2
BLAKE2b-256 0a39fb11c8e3208aaf635637fc106067a10e2d67f96ab1ebd57f204d57f818fe

See more details on using hashes here.

File details

Details for the file nexqloud_dcp-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nexqloud_dcp-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 173.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for nexqloud_dcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ede61207772e6ad16a8ef127efcfd1e2c2cc41a1b5cf5108c005deb1c754556
MD5 24f3d48f579fb85310b2988894a6dc49
BLAKE2b-256 d130920e2aaac727c6a5ce70867c5232b5f165ed292532eee5c26bb338d7b840

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