harbor-py icon indicating copy to clipboard operation
harbor-py copied to clipboard

The missing harbor python SDK

Deprecated! This project has been moved to harbor.

Introduction

harbor is the enterprise-class registry server for docker distribution.

harbor-py is the native and compatible python SDK for harbor. The supported APIs are list below.

  • [x] Projects APIs
    • [x] Get projects
    • [x] Create project
    • [x] Check project exist
    • [x] Set project publicity
    • [x] Get project id from name
    • [ ] Get project access logs
    • [ ] Get project member
    • [ ] Get project and user member
  • [x] Users APIs
    • [x] Get users
    • [x] Create user
    • [x] Update user profile
    • [x] Delete user
    • [x] Change password
    • [x] Promote as admin
  • [x] Repositories APIs
    • [x] Get repositories
    • [x] Delete repository
    • [x] Get repository tags
    • [x] Get repository manifests
  • [x] Others APIs
    • [x] Search
    • [x] Get statistics
    • [x] Get top accessed repositories
    • [x] Get logs

Installation

pip install harbor-py

Usage

from harborclient import harborclient

host = "127.0.0.1"
user = "admin"
password = "Harbor12345"

client = harborclient.HarborClient(host, user, password)

client.get_projects()
client.get_users()
client.get_statistics()
client.get_top_accessed_repositories()
client.search("library")

For more usage, please refer to the examples.

Contribution

If you have any suggestion, feel free to submit issues or send pull-requests for harbor-py.

Publish harbor-py package to pypi server with the following commands.

python setup.py register -r pypi
python setup.py sdist upload  -r pypi