Veeam Backup & Replication REST API wrapper for Python
Project description
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
- Download the OpenAPI schema into openapi_schemas
- Install the openapi-python-client package
- Run
python fix_openapi_yaml.py .\openapi_schemas\vbr_rest_{version}.yaml .\openapi_schemas\vbr_rest_{version}_fixed.yaml - Run
openapi-python-client generate --path ".\openapi_schemas\vbr_rest_{version}_fixed.json" --output-path ".\veeam_br" --overwrite - Fix any warnings/errors
- Rename the folder to match the API version (i.e.,
v1.3-rev1) - Add the version mapping to versions.py
- Write pytest tests
- If an older API has been deprecated, delete its folder, json, and version.py entry, 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
Recommended Usage (Smart Client)
The VeeamClient handles:
- API version routing
- Authentication
- Token refresh
x-api-versionheader injection so package API version matches header values- Async calls
- Operation discovery
Each packaged version can be called independently through separate imports, but this is the recommended way to use this library.
Create a client and connect
import asyncio
from veeam_br.client import VeeamClient
async def main():
vc = VeeamClient(
host="https://vbr.example.com:9419",
username="administrator",
password="SuperSecretPassword",
api_version="1.3-rev1",
verify_ssl=False,
)
await vc.connect()
# use the client...
await vc.close()
asyncio.run(main())
Call an API endpoint (async)
repos = await vc.call(
vc.api("repositories").get_all_repositories
)
Filter certain object types
Some objects, such as SmartObjectS3, use polymorphic subtypes with circular inheritance. These tend to not play well with package creation tools, so as part of the import process into this project, those relationships are broken. Where a repository would normally have a bucket object with immutability information inside, this breakage instead causes bucket to always be UNSET and instead populates the data into additional_properties. For example:
from veeam_br.v1_3_rev1.models.e_repository_type import ERepositoryType
smart_s3 = [
r for r in repos.data
if r.type_ == ERepositoryType.SMARTOBJECTS3
]
So to access bucket & immutability data:
for repo in smart_s3:
bucket = repo.additional_properties.get("bucket", {})
immutability = bucket.get("immutability", {})
print({
"name": repo.name,
"bucket": bucket.get("bucketName"),
"days": immutability.get("daysCount"),
"enabled": immutability.get("isEnabled"),
})
Until openapi-python-client figures out and implements a way around this or Veeam rewrites their OpenAPI schemas to not use circular references/inheritance, this is a known limitation.
Call any endpoint
Operations map directly to the OpenAPI layout:
api/
└── repositories/
└── get_all_repositories.py
Call it like this:
await vc.call(
vc.api("repositories").get_all_repositories
)
Or explicity:
await vc.call(
vc.api("repositories.get_all_repositories")
)
Pagination example
result = await vc.call(
vc.api("repositories").get_all_repositories,
limit=50,
skip=0,
)
Close the client
await vc.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file veeam_br-0.2.0b1.tar.gz.
File metadata
- Download URL: veeam_br-0.2.0b1.tar.gz
- Upload date:
- Size: 3.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3002e9c48cd1004398874a42529e0cc9eab32e71501b8641aec29d872158cbd
|
|
| MD5 |
09a27f0dafb15ccf8a6b9cbe4c87c3d8
|
|
| BLAKE2b-256 |
6bdfd3f29855adc9d226edde84cc26a618ec7c5a823a1e565a160e14acb46a44
|
Provenance
The following attestation bundles were made for veeam_br-0.2.0b1.tar.gz:
Publisher:
publish-on-release.yml on Cenvora/veeam-br
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veeam_br-0.2.0b1.tar.gz -
Subject digest:
b3002e9c48cd1004398874a42529e0cc9eab32e71501b8641aec29d872158cbd - Sigstore transparency entry: 875541129
- Sigstore integration time:
-
Permalink:
Cenvora/veeam-br@6feebe01456742f3f11c6fe8b4548e30ae2687df -
Branch / Tag:
refs/tags/0.2.0b1 - Owner: https://github.com/Cenvora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-release.yml@6feebe01456742f3f11c6fe8b4548e30ae2687df -
Trigger Event:
push
-
Statement type:
File details
Details for the file veeam_br-0.2.0b1-py3-none-any.whl.
File metadata
- Download URL: veeam_br-0.2.0b1-py3-none-any.whl
- Upload date:
- Size: 5.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c3be05939a8701b1925ccbd3e172af9f94cceb8075ecd6781bd4c036cdbf39f
|
|
| MD5 |
2d519dd8a8f5142df50ae276b853d06f
|
|
| BLAKE2b-256 |
1ecbeeac1d57f1b39d8509ad86674d81fa96f032d807976a16a66102886d784e
|
Provenance
The following attestation bundles were made for veeam_br-0.2.0b1-py3-none-any.whl:
Publisher:
publish-on-release.yml on Cenvora/veeam-br
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
veeam_br-0.2.0b1-py3-none-any.whl -
Subject digest:
5c3be05939a8701b1925ccbd3e172af9f94cceb8075ecd6781bd4c036cdbf39f - Sigstore transparency entry: 875541184
- Sigstore integration time:
-
Permalink:
Cenvora/veeam-br@6feebe01456742f3f11c6fe8b4548e30ae2687df -
Branch / Tag:
refs/tags/0.2.0b1 - Owner: https://github.com/Cenvora
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-on-release.yml@6feebe01456742f3f11c6fe8b4548e30ae2687df -
Trigger Event:
push
-
Statement type: