nebhale / client-python

Service Bindings for Kubernetes Python Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

client-python

Tests codecov

client-python is a library to access Service Binding Specification for Kubernetes conformant Service Binding Workload Projections.

Example

import psycopg2 as psycopg2

from bindings import bindings

b = bindings.from_service_binding_root()
b = bindings.filter(b, "postgresql")

if len(b) != 1:
raise ValueError("Incorrect number of PostgreSQL bindings: %s" % len(b))

u = b[0].get("url")
if u is None:
    raise ValueError("No URL in binding")

conn = psycopg2.connect(u)

# ...

License

Apache License v2.0: see LICENSE for details.

About

Service Bindings for Kubernetes Python Client

License:Apache License 2.0


Languages

Language:Python 100.0%