Skip to main content

Lightweight Python SDK for the PFC API

Project description

pfc-client

pfc-client is the lightweight Python SDK for customers integrating with the PFC API.

Install

pip install pfc-client

For local development from this repository:

pip install ./sdk/python

Quickstart

from pfc_client import PFCClient, guarded_tool

client = PFCClient(
    api_url="https://pfc-api.fly.dev",
    api_key="YOUR_API_KEY",
)

decision = client.evaluate(
    action="deploy_production",
    subject={"type": "agent", "id": "website-backend"},
    resource={"type": "service", "id": "checkout-api"},
)

print(decision)

Base URL Configuration

By default the client points to the hosted PFC API:

client = PFCClient()

To use a different environment:

client = PFCClient(api_url="https://your-pfc-host.example.com")

API Key Usage

Pass your website customer API key when creating the client:

client = PFCClient(
    api_url="https://pfc-api.fly.dev",
    api_key="pfc_live_your_api_key",
)

The SDK sends the key as the x-api-key header on evaluate requests.

Check Your Usage

API Key Usage refers to how you authenticate requests.

API Usage refers to how you check your customer-specific request totals after authenticating.

To view your own usage, call the hosted usage endpoint with the same API key:

curl https://pfc-api.fly.dev/v1/usage/me \
  -H "x-api-key: YOUR_PFC_API_KEY"

The current Python SDK does not yet expose a client.get_usage() helper. The HTTP endpoint is available today, and adding an SDK method for usage lookup would be a good future enhancement.

Guarded Tool Example

from pfc_client import PFCClient, guarded_tool

client = PFCClient(api_key="pfc_live_your_api_key")


@guarded_tool(client)
def deploy():
    print("Deploying to production")


deploy()

Supported Operations

  • client.evaluate(...) submits an action for policy and authority evaluation
  • client.verify(...) verifies an artifact against a public key via the API

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

pfc_client-0.1.4.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

pfc_client-0.1.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pfc_client-0.1.4.tar.gz.

File metadata

  • Download URL: pfc_client-0.1.4.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pfc_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 2cc411b59e0f323dc9ec66dee87ca3f74c56d238082dc89030ff44db833a886e
MD5 b19a93ef3d58f848ecb187c85f1d1961
BLAKE2b-256 2b0ce55f129958b8c1a4895059f94cb76f62b2f34b5a473ffeb7f8bcd6289ad6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pfc_client-0.1.4.tar.gz:

Publisher: publish-pypi-sdk.yml on danlevans1/PFC-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pfc_client-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: pfc_client-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pfc_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a64043358eb8c81a1eb365c7a17e3b442a502b6e7b0c9040348be2e1d8105773
MD5 66cbd134cf29762b81dd2bc2a2a69710
BLAKE2b-256 849f01ec5a62018f0dbe9654ad3fd09a4667bcfc1854086bbfdebaab28756b0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pfc_client-0.1.4-py3-none-any.whl:

Publisher: publish-pypi-sdk.yml on danlevans1/PFC-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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