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.
| 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 | ❌ |
- 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
pip install veeam-br
Clone the repository and install dependencies:
git clone https://github.com/Cenvora/veeam-br.git
cd veeam-br
pip install -e .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.
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())repos = await vc.call(
vc.api("repositories").get_all_repositories
)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.
Operations map directly to the OpenAPI layout:
api/
└── repositories/
└── get_all_repositories.pyCall it like this:
await vc.call(
vc.api("repositories").get_all_repositories
)Or explicity:
await vc.call(
vc.api("repositories.get_all_repositories")
)result = await vc.call(
vc.api("repositories").get_all_repositories,
limit=50,
skip=0,
)await vc.close()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.
This project is made possible thanks to the efforts of our core contributors:
We’re grateful for their continued support and contributions.
