Async Harbor API v2.0 client
Project description
harborapi
Python async client for the Harbor REST API v2.0.
Features
- Async API
- Extensive type hint coverage
- Data validation with Pydantic
- Built-in retry functionality with backoff
- Extensive test coverage powered by Hypothesis
- Optional rich support
Installation
pip install harborapi
Quick Start
import asyncio
from harborapi import HarborAsyncClient
client = HarborAsyncClient(
url="https://demo.goharbor.io/api/v2.0/",
username="username",
secret="secret",
# OR
credentials="base64-basic-auth-credentials",
# OR
credentials_file="path/to/robot-credentials-file.json",
)
async def main() -> None:
# Get all projects
projects = await client.get_projects()
for project in projects:
print(project.name)
# If you have rich installed:
import rich
for project in projects:
rich.print(project)
asyncio.run(main())
Documentation
Documentation is available here
Implemented endpoints
- user
- gc
- scanAll
- configure
- usergroup
- preheat
- replication
- label
- robot
- webhookjob
- icon
- project
- webhook
- scan
- member
- ldap
- registry
- search
- artifact
- immutable
- retention
- scanner
- systeminfo**
- statistic
- quota
- repository
- ping
- oidc
- SystemCVEAllowlist
- Health
- robotv1
- projectMetadata
- auditlog
** /systeminfo/getcert
NYI
0.8.0 - 2023-02-08
Added
limit
parameter for all methods that return a list of items. This parameter is used to limit the number of items returned by the API. See the docs for more details.
Removed
retrieve_all
parameter for all methods that return a list of items. Use the newlimit
parameter to control the number of results to retrieve. Passingretrieve_all
to these methods will be silently ignored. In the future this will raise a DeprecationWarning.
0.7.1 - 2023-02-07
Added
- New parameters
raw
andvalidate
toHarborAsyncClient
andHarborClient
to control whether the client returns the raw data from the API, and whether the client validates the data from the API, respectively. See the docs for more details.
0.7.0 - 2023-02-06
Added
- New models from 2022-11-28 spec update.
Changed
- Updated models from 2022-11-28 spec update.
- Generated models are now defined in
models._models
andmodels._scanner
, and the overrides for these models are defined inmodels.models
andmodels.scanner
respectively. This is to make it easier to regenerate the models in the future while keeping the extended functionality (such asRepository.project_name
,ScanOverview.__new__
, etc.) for these classes intact, since that is now declared separately from the generated models. Furthermore,models.models
andmodels.scanner
both re-export all the generated models so that the API remains unchanged. See the Justfile for more details on how the models are generated.
Fixed
HarborAsyncClient.search()
raising an error when finding Helm Charts with an emptyengine
field.
Removed
- BREAKING:
HarborAsyncClient.get_internal_config()
. This endpoint is meant for internal usage only, and the new model definitions don't seem to play well with it. If you need this endpoint, please open an issue.
0.6.0 - 2023-01-30
Changed
- BREAKING: The
max_depth
parameter of theas_table()
andas_panel()
methods on all models now starts counting from 1 instead of 0.max_depth=0
now means "no limit", andmax_depth=1
means "only show the top level" (previouslymax_depth=0
meant "only show the top level" andmax_depth=1
meant "show the top level and one level below")
0.5.0 - 2023-01-17
Added
- Changelog
- Rich as optional dependency:
pip install harborapi[rich]
Changed
- Use Hatch as build system.
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
harborapi-0.8.0.tar.gz
(124.1 kB
view hashes)
Built Distribution
harborapi-0.8.0-py3-none-any.whl
(87.9 kB
view hashes)
Close
Hashes for harborapi-0.8.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e48a65ddd7231086e673fc754d3e07df1ffa7dcf6f52d074eaf25950d2dd089b |
|
MD5 | 4322814c96b634a0e0b3247d89292922 |
|
BLAKE2b-256 | 634b1349e215b6684c5e577030fbab681dd3761d5ad26fb1fef411a3fe49a0e1 |