Skip to main content

Python container registry API library.

Project description

CoregIO

PyPI version

The CoregIO Python Library empowers you to seamlessly fetch objects from the Container Registry API. This capability enables you to retrieve container images, manifests and other objects stored in a Container registry with ease. With a simple and intuitive interface, you can specify the object you want to fetch, such as an image by its name and tag, and the library takes care of the underlying API calls and data retrieval. Whether you need to pull a specific image or access various objects within the registry, this library streamlines the process, allowing you to interact with the Docker Registry API effortlessly.

Supported auth methods

In order to connect to a remote registry using standard docker registry API the library supports several authentication methods.

  • Bearer
  • OAuth2
  • Basic

How to install

The library is available on PyPi and can be downloaded using pip.

$ pip install coregio

Usage

The Coregio Python Library empowers you to seamlessly fetch objects from the Container Registry API. This capability enables you to retrieve container images, manifests and other objects stored in a Container registry with ease. With a simple and intuitive interface, you can specify the object you want to fetch, such as an image by its name and tag, and the library takes care of the underlying API calls and data retrieval. Whether you need to pull a specific image or access various objects within the registry, this library streamlines the process, allowing you to interact with the Docker Registry API effortlessly.

Repository tags

from coregio.registry_api import ContainerRegistry

# Create a registry interface and fetch repository tags
registry = ContainerRegistry("quay.io")
tags = registry.get_tags("prometheus/node-exporter")
print(tags)
['v0.17.0', 'v0.15.1', 'v0.15.2', 'latest', 'master']

Image manifest

manifest = registry.get_manifest(
    "prometheus/node-exporter",
    "latest",
)
print(manifest)
{'schemaVersion': 2, 'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'config': {'mediaType': 'application/vnd.docker.container.image.v1+json', 'size': 3361, 'digest': 'sha256:173d3570a5af2b2ef8816b40af3ca985280549520e8d328a7f20333d9f354d1b'}, 'layers': [{'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 777654, 'digest': 'sha256:e6b9e25f5d0157c1c76c9d3680c4645368c9ac87cb008b5eddf9d856b8551373'}, {'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 486261, 'digest': 'sha256:0c6a06713be86bfb61b5f1ce1217f7b509c7ea7b894af65149cafac5004ee28f'}, {'mediaType': 'application/vnd.docker.image.rootfs.diff.tar.gzip', 'size': 10458504, 'digest': 'sha256:15ef7072c2ab4f35955068b02a09e669a5613d5bfca4f5c442c45b958036f17a'}]}


# User can select a manifest type based on accept headers
manifest = registry.get_manifest(
    "prometheus/node-exporter",
    "latest",
    manifest_types=["oci_index"]
)
print(manifest)
{'schemaVersion': 2, 'mediaType': 'application/vnd.docker.distribution.manifest.list.v2+json', 'manifests': [{'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'size': 595, 'digest': 'sha256:1b2da31e89c8efe8d67f726f9872ca2fce95ddb1d5d97fd71468d5c48de85ddf', 'platform': {'architecture': 'amd64', 'os': 'linux'}}, {'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'size': 595, 'digest': 'sha256:18ef5a4eb0a00e0513c8d4fb87bc31728e4c7ed6caea83c608c5048418b00185', 'platform': {'architecture': 'ppc64le', 'os': 'linux'}}, {'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'size': 595, 'digest': 'sha256:c3e79af3edaf3b05282565c0b3e08e5b189e4200153114475256d00367da09da', 'platform': {'architecture': 's390x', 'os': 'linux'}}, {'mediaType': 'application/vnd.docker.distribution.manifest.v2+json', 'size': 595, 'digest': 'sha256:7da24517de68a4af11f098841d10c2e02f12619c662e5b812bff7959e2a477a6', 'platform': {'architecture': 'arm64', 'os': 'linux'}}]}
# Using a proxy
registry = ContainerRegistry(
    "quay.io",
    proxy="http://proxy.example.com"
)

manifest = registry.get_manifest(
    "redhat-isv-containers/5e61e93ffe2231a0c286037e",
    "latest",
)

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request. Please follow our CONTRIBUTING.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coregio-0.7.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

coregio-0.7.1-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file coregio-0.7.1.tar.gz.

File metadata

  • Download URL: coregio-0.7.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for coregio-0.7.1.tar.gz
Algorithm Hash digest
SHA256 4e0a0fd4ae38c6764442100530009aa51da307b41fcc8c48d0e12f302065cfe6
MD5 053bfe60b2927576941adc0a464ef892
BLAKE2b-256 c7c0307f57e5b31485017acc1c533fbd811db0b014cf33f704b3a8d3e393b590

See more details on using hashes here.

File details

Details for the file coregio-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: coregio-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for coregio-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9fc1df8d3bad4c5f9f480f13f4646ba7e8ad26e0d3d4d48ec85da6bfe4d3f609
MD5 a50f69f70260d2781734398c87b1d278
BLAKE2b-256 44e2aac2d0e6b96da03541f7b148696bc85be48409ebefe91892cf65592ef4ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page