Skip to main content

Veeam Backup & Replication REST API wrapper for Python

Project description


Veeam Logo

Veeam Backup & Replication Python API Wrapper

Python package for interacting with the Veeam Backup & Replication REST API

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

Supported Versions

VBR Version API Version Supported
13.0.1.180 1.3-rev1
13.0.0.4967 1.3-rev0
12.3.1.1139 1.2-rev1
< 12.3.1.1139 < 1.2-rev1

How to support new API versions

  1. Download the OpenAPI schema into openapi_schemas
  2. Install the openapi-python-client package
  3. Run openapi-python-client generate --path ".\openapi_schemas\vbr_rest_{version}.json" --output-path ".\veeam_br" --overwrite
  4. Fix any warnings/errors
  5. Rename the folder to match the API version (i.e., v1.3-rev1)
  6. Write pytest tests
  7. If an older API has been deprecated, delete its folder and yaml, then update the supported versions section of the readme

Install

From PyPi

pip install veeam-br

From Source

Clone the repository and install dependencies:

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

Usage

Basic Usage

First, create a client from the appropriate API version:

from veeam_br.v1_3_rev1 import Client

client = Client(base_url="https://api.example.com:9419")

Log in to the service (this requires an account with MFA disabled):

from veeam_br.v1_3_rev1.client import Client
from veeam_br.v1_3_rev1.models.token_login_spec import TokenLoginSpec
from veeam_br.v1_3_rev1.api.login import create_token
from veeam_br.v1_3_rev1.models.e_login_grant_type import ELoginGrantType

client = Client(
    base_url="https://vbr.example.com:9419",
    verify_ssl=False
)

body = TokenLoginSpec(
    grant_type=ELoginGrantType.PASSWORD,
    username="administrator",
    password="SuperSecretPassword"
)

with client as client:
    token = create_token.sync(
        client=client,
        body=body,
        x_api_version="1.3-rev1",
    )

Now switch to the AuthenticatedClient:

auth_client = AuthenticatedClient(
    base_url=client._base_url,
    token=token.access_token,
    verify_ssl=client._verify_ssl,
)

Now call your endpoint and use your models:

from veeam_br.v1_3_rev1.models import ServerTimeModel
from veeam_br.v1_3_rev1.api.service import get_server_time
from veeam_br.v1_3_rev1.types import Response

with auth_client as auth_client:
    my_data: ServerTimeModel = get_server_time.sync(client=auth_client, x_api_version="1.3-rev1")
    # or if you need more info (e.g. status_code)
    response: Response[ServerTimeModel] = get_server_time.sync_detailed(client=auth_client, x_api_version="1.3-rev1")

Async Usage

Or do the same thing with an async version:

from veeam_br.v1_3_rev1.models import ServerTimeModel
from veeam_br.v1_3_rev1.api.service import get_server_time
from veeam_br.v1_3_rev1.types import Response

async with auth_client as auth_client:
    my_data: ServerTimeModel = await get_server_time.asyncio(client=auth_client, x_api_version="1.3-rev1")
    response: Response[ServerTimeModel] = await get_server_time.asyncio_detailed(client=auth_client, x_api_version="1.3-rev1")

SSL Verification

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

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

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

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_br-0.1.1b1.tar.gz (2.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_br-0.1.1b1-py3-none-any.whl (4.7 MB view details)

Uploaded Python 3

File details

Details for the file veeam_br-0.1.1b1.tar.gz.

File metadata

  • Download URL: veeam_br-0.1.1b1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for veeam_br-0.1.1b1.tar.gz
Algorithm Hash digest
SHA256 547d1df7b214f9f40c2b16bafa0682326fa3ef9c3487ea2c7af4189ceb32a815
MD5 cffb258f18703905284c80c94114854a
BLAKE2b-256 aa8eed2a2900d0b6d4eebfcea29c67e353ab35ca40064572cc4303a437383adb

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_br-0.1.1b1.tar.gz:

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

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_br-0.1.1b1-py3-none-any.whl.

File metadata

  • Download URL: veeam_br-0.1.1b1-py3-none-any.whl
  • Upload date:
  • Size: 4.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for veeam_br-0.1.1b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f02e3bb47f28187f38ed5e69840d9cde5344cd4bb09a23418374010f869318b
MD5 2fd94b15ed4182c7bf3c1c1d69af6987
BLAKE2b-256 c92089ad370cf371dabf90926c7983c4d4cf8b4495ea75e910dbedd2fa67c87d

See more details on using hashes here.

Provenance

The following attestation bundles were made for veeam_br-0.1.1b1-py3-none-any.whl:

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

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