Registry / http-networking / harborapi

harborapi

JSON →
library0.26.2pypypi✓ verified 84d ago

Async Python client for Harbor v2.0 API. Handles authentication, rate limiting, and all CRUD operations for Harbor registry resources (projects, repositories, artifacts, robots, users, etc.). Latest version 0.26.2, requires Python >=3.8. Actively maintained with monthly releases.

pip install harborapi
INSTALL
IMPORT
SIG · HARBORAPI
H
harborapi
http-networkingpythonv0.26.2
Install
3.8s avg
Import
1324ms
Disk
31MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.392s · 32.6MB
glibc
py 3.103.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())
Debug
Known issues
breakingVersion 0.22.0+ drops Python 3.7 support. If you are on Python 3.7, pin harborapi<0.22.0.
fix
Update to Python >=3.8 or pin harborapi==0.21.0
affects: >=0.22.0
breakingIn version 0.20.0 the client factory function 'create_client' was removed. Use 'HarborAsyncClient' directly.
fix
Replace 'from harborapi import create_client' with 'from harborapi import HarborAsyncClient'
affects: >=0.20.0
gotchaThe client does not automatically refresh expired authentication tokens. You must catch '401' errors and re-authenticate.
fix
Wrap client calls with retry logic that re-calls login on 401.
affects: all
deprecatedParameter 'verify_ssl' is deprecated in v0.25.0+ in favor of 'verify' (bool or SSLContext).
fix
Use 'verify=True' instead of 'verify_ssl=True'
affects: >=0.25.0
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.
fix
Use '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).
fix
Verify 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.
fix
Check 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
Agent activity
26 hits · last 30 days
node
26
Resources
harborapi — pip install harborapi · libregistry