Skip to main content

Veeam Service Provider Console REST API wrapper for Python

Project description


Veeam Logo

Veeam Service Provider Console Python API Wrapper

Python package for interacting with the Veeam Service Provider Console REST API

This project is an independent, open source Python client for the Veeam Service Provider Console REST API. It is not affiliated with, endorsed by, or sponsored by Veeam Software.

Supported Versions

VSPC Version API Version Supported
9 3.6
8.1 3.5.1
< 8.1 < 3.5.1

How to support new API versions

  1. Download the OpenAPI yaml into openapi_schemas
  2. Install the openapi-python-client package
  3. Fix the OpenAPI yaml to conform to proper standards: python fix_openapi_yaml.py .\openapi_schemas\vspc_rest_{vspc_version}.yaml .\openapi_schemas\vspc_rest_{vspc_version}_fixed.yaml
  4. Run openapi-python-client generate --path ".\openapi_schemas\vspc_rest_{vspc_version}_fixed.yaml" --output-path ".\veeam_spc" --overwrite
  5. Fix any warnings/errors (application/binary+base64 can be ignored)
  6. Rename the folder to match the API version (i.e., v3_5_1)
  7. Update pyproject.toml to support the new packages
  8. Write pytest tests
  9. If an older API has been deprecated, delete its folder and yaml, then remove it from pyproject.toml

Install

From PyPi

pip install veeam-spc

From Source

Clone the repository and install dependencies:

git clone https://github.com/Cenvora/veeam-spc.git
cd veeam-spc
pip install -e .

Usage Tips

  • For endpoints requiring authentication, use AuthenticatedClient instead of Client.
  • To support multiple API versions, import the client and models from the desired versioned subpackage (e.g., veeam_spc.v3_5_1).
  • For file downloads (PDF, CSV, etc.), access the raw response content: response.content.
  • Refer to the generated api and models modules for available endpoints and request/response schemas.

Usage

Basic Usage

First, create a client from the appropriate API version:

from veeam_spc.v3_5_1 import Client

client = Client(base_url="https://server:1280/api/v3")

If the endpoints you're going to hit require authentication, use AuthenticatedClient:

from veeam_spc.v3_5_1 import AuthenticatedClient

client = AuthenticatedClient(base_url="https://server:1280/api/v3", token="SuperSecretToken")

Now call your endpoint and use your models:

from veeam_spc.v3_5_1.models import About
from veeam_spc.v3_5_1.api.about import get_about
from veeam_spc.v3_5_1.types import Response

with client:
    about_info: About = get_about.sync(client=client)
    # or if you need more info (e.g. status_code)
    response: Response[About] = get_about.sync_detailed(client=client)

Async Usage

Or do the same thing with an async version:

from veeam_spc.v3_5_1.models import About
from veeam_spc.v3_5_1.api.about import get_about
from veeam_spc.v3_5_1.types import Response

client = AuthenticatedClient(base_url="https://server:1280/api/v3", token="SuperSecretToken")

async with client:
    about_info = await get_about.asyncio(client=client)
    response: Response[About] = await get_about.asyncio_detailed(client=client)

SSL Verification

By default, HTTPS APIs will verify SSL certificates. You can pass a custom certificate bundle or disable verification (not recommended):

from veeam_spc.v3_5_1 import AuthenticatedClient

client = AuthenticatedClient(
    base_url="https://internal_api.example.com/api/v3",
    token="SuperSecretToken",
    verify_ssl="/path/to/certificate_bundle.pem",
)

# Disable SSL verification (security risk)
client = AuthenticatedClient(
    base_url="https://internal_api.example.com/api/v3",
    token="SuperSecretToken",
    verify_ssl=False
)

Advanced Customizations

You can customize the underlying httpx.Client or httpx.AsyncClient:

from veeam_spc.v3_5_1 import Client

def log_request(request):
    print(f"Request event hook: {request.method} {request.url} - Waiting for response")

def log_response(response):
    request = response.request
    print(f"Response event hook: {request.method} {request.url} - Status {response.status_code}")

client = Client(
    base_url="https://server:1280/api/v3",
    httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)
# Or get the underlying httpx client to modify directly with client.get_httpx_client() or client.get_async_httpx_client()

Building / Publishing

This project uses Poetry for dependencies and packaging:

  1. Update metadata in pyproject.toml (authors, version)
  2. Configure private repositories if needed
    • poetry config repositories.<your-repository-name> <url>
    • poetry config http-basic.<your-repository-name> <username> <password>
  3. Publish: poetry publish --build -r <your-repository-name> or poetry publish --build for PyPI

To install into another project without publishing:

  1. If using Poetry: poetry add <path-to-this-client>
  2. If not using Poetry:
    • Build a wheel: poetry build -f wheel
    • Install: pip install <path-to-wheel>

Contributing

Contributions are welcome! To contribute:

  • Fork the repository
  • Create a feature branch
  • Make your changes and add tests
  • Submit a pull request with a clear description

Please follow PEP8 style and include docstrings for new functions/classes.

🤝 Core Contributors

This project is made possible thanks to the efforts of our core contributors:

We’re grateful for their continued support and contributions.

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

veeam_spc-0.1.0b2.tar.gz (3.1 MB view details)

Uploaded Source

Built Distribution

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

veeam_spc-0.1.0b2-py3-none-any.whl (7.1 MB view details)

Uploaded Python 3

File details

Details for the file veeam_spc-0.1.0b2.tar.gz.

File metadata

  • Download URL: veeam_spc-0.1.0b2.tar.gz
  • Upload date:
  • Size: 3.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for veeam_spc-0.1.0b2.tar.gz
Algorithm Hash digest
SHA256 b7fa766cc2a778fffb6958fd8517a5aa2d2ad03947ca18914359110936eb07e4
MD5 7f6279b43e111394a5eda9dc8df0d33d
BLAKE2b-256 ad307feffaaf77cb4c960614a109970a581bc1f77f4cd8b05e1732afe72baa09

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_spc-0.1.0b2.tar.gz:

Publisher: publish-on-release.yml on Cenvora/veeam-spc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file veeam_spc-0.1.0b2-py3-none-any.whl.

File metadata

  • Download URL: veeam_spc-0.1.0b2-py3-none-any.whl
  • Upload date:
  • Size: 7.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for veeam_spc-0.1.0b2-py3-none-any.whl
Algorithm Hash digest
SHA256 08662d5c921de30da2fc2161f8019e7f48579cc085faa7b3731e04308362090f
MD5 74d5a712218e3e7ae6c10970f1fd8166
BLAKE2b-256 f8f9e4dbbce038ee00a2a7cf4defff59e4b75da9f1371fb19a397265f91da6c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_spc-0.1.0b2-py3-none-any.whl:

Publisher: publish-on-release.yml on Cenvora/veeam-spc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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