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.7.0.tar.gz (76.5 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.7.0-py3-none-any.whl (92.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: podman-4.7.0.tar.gz
  • Upload date:
  • Size: 76.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for podman-4.7.0.tar.gz
Algorithm Hash digest
SHA256 01e3385445b3a5f30bad035439de651a8ea62810d94df853bed6f8f150cd4b7f
MD5 40c7132514b776392e97d1a0f08c54e6
BLAKE2b-256 84ecae01ba446ab3f74ac7af875063694d0462344806f85c4e9e2894ed1c6bfc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: podman-4.7.0-py3-none-any.whl
  • Upload date:
  • Size: 92.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for podman-4.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3fb03cc0f8b00fb91c273db1b9f86595cde7a5343a74e66cf19916fa34e096ae
MD5 2a6b1c98968e56413ab82c1e6088a376
BLAKE2b-256 6e0d5023a43c9c402615c506794dd79f7f4116cb588c59da4d37c4e830b2dc26

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