Skip to main content

Bindings for Podman RESTful API

Project description

podman-py

Build Status

This python package is a library of bindings to use the RESTful API of Podman. It is currently under development and contributors are welcome!

Dependencies

Example usage

"""Demonstrate PodmanClient."""
import json
from podman import PodmanClient

# Provide a URI path for the libpod service.  In libpod, the URI can be a unix
# domain socket(UDS) or TCP.  The TCP connection has not been implemented in this
# package yet.

uri = "unix:///run/user/1000/podman/podman.sock"

with PodmanClient(base_url=uri) as client:
    version = client.version()
    print("Release: ", version["Version"])
    print("Compatible API: ", version["ApiVersion"])
    print("Podman API: ", version["Components"][0]["Details"]["APIVersion"], "\n")

    # get all images
    for image in client.images.list():
        print(image, image.id, "\n")

    # find all containers
    for container in client.containers.list():
        first_name = container['Names'][0]
        container = client.containers.get(first_name)
        print(container, container.id, "\n")

        # available fields
        print(sorted(container.attrs.keys()))

    print(json.dumps(client.df(), indent=4))

Contributing

See 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

podman-4.0.0.tar.gz (73.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

podman-4.0.0-py3-none-any.whl (89.4 kB view details)

Uploaded Python 3

File details

Details for the file podman-4.0.0.tar.gz.

File metadata

  • Download URL: podman-4.0.0.tar.gz
  • Upload date:
  • Size: 73.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.10.0

File hashes

Hashes for podman-4.0.0.tar.gz
Algorithm Hash digest
SHA256 009e6a8874fed6a7c0cc80373dd4e1d5706598b8041cf809ee4b3294ac29ec5c
MD5 2f687a6bbe5d83be83451f1a756d0492
BLAKE2b-256 3e772de1f2f6487361f887e4f7515b64a4f9d2a01d4e79b25c44b249f84c8208

See more details on using hashes here.

File details

Details for the file podman-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: podman-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 89.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.10.0

File hashes

Hashes for podman-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c283e828559d2c471480371e8cc71b5e06c5fd85212c4771a0fc554d917a7337
MD5 fdff8a6191940b8b99aae9ee7371b969
BLAKE2b-256 82785b7f42866eb2f839361f1a70f1288266eef0aac6bb3e85d9adab0019305b

See more details on using hashes here.

Supported by

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