Install & Compatibility
Where this runs
tested against v0.26.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.392s · 32.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 1.256s · 32MB
31MB installed
● package 31MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HarborClient
✓ from harborapi import HarborClient
✗ from harborapi.client import HarborClient
In older versions HarborClient was in a submodule. Now it's exposed at package level.
HarborAsyncClient
✓ from harborapi import HarborAsyncClient
Primary client class for async usage.
Create an async client, authenticate with username/password, list projects.
import asyncio
from harborapi import HarborAsyncClient
async def main():
client = HarborAsyncClient(
url="https://your-harbor-instance.com",
username="admin",
password="password", # or use secret
verify=True
)
# List all projects
projects = await client.get_projects()
for project in projects:
print(project.name)
await client.close()
asyncio.run(main())
Errors
Common errors & fixes
ImportError: cannot import name 'HarborClient' from 'harborapi'
Older import path used 'from harborapi.client import HarborClient', but that module was restructured.
fixUse 'from harborapi import HarborAsyncClient' (or HarborClient if sync, but sync is deprecated).
harborapi.exceptions.Forbidden: Forbidden
The authenticated user does not have the required permissions for the requested resource (e.g., admin privileges).
fixVerify the user/robot has correct permissions in Harbor UI. Use an admin account or robot account with 'system_admin' role.
httpx.ConnectError: [Errno 8] nodename nor servname provided, or not known
The Harbor URL provided to the client is incorrect or the DNS cannot resolve the hostname.
fixCheck the URL (e.g., 'https://myharbor.example.com'). Ensure the host is reachable from your network.
Upgrade
Version history
0.26.2latest on PyPI · released Jan 21, 2025
Audit
Dependencies
httpxrequiredHTTP client for async requests
pydanticrequiredData validation and serialization
pyyamlrequiredYAML parsing for configuration