Skip to main content

Official Python SDK for Plystra.

Project description

plystra

Official Python SDK for Plystra Core v1.0.

PyPI package name: plystra

Install

pip install plystra

Synchronous Usage

from plystra import Plystra

with Plystra("http://localhost:8080") as plystra:
    plystra.auth.login("alice@example.com", "plystra-demo")

    decision = plystra.authz.check(
        actor={
            "user_id": "user_alice",
            "space_id": "space_acme",
            "member_id": "member_finance_reviewer",
            "user_member_id": "um_alice_finance_reviewer",
        },
        resource_type="invoice",
        resource_id="invoice_001",
        action="approve",
    )

    print(decision["decision"])

Asynchronous Usage

import asyncio
from plystra import AsyncPlystra


async def main() -> None:
    async with AsyncPlystra("http://localhost:8080") as plystra:
        await plystra.auth.login("alice@example.com", "plystra-demo")
        decision = await plystra.authz.check(
            actor_user_id="user_alice",
            actor_member_id="member_finance_reviewer",
            actor_user_member_id="um_alice_finance_reviewer",
            space_id="space_acme",
            resource_type="invoice",
            resource_id="invoice_001",
            action="approve",
        )
        print(decision["decision"])


asyncio.run(main())

Modules

The SDK exposes v1.0 Core modules as attributes:

  • system
  • auth
  • actor
  • admin
  • users
  • spaces
  • groups
  • members
  • user_members
  • roles
  • member_roles
  • permissions
  • role_permissions
  • resource_types
  • resources
  • authz
  • audit
  • data
  • plugins
  • templates

Non-public endpoints require a Bearer session whose user has an active admin grant.

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

plystra-1.0.0.dev1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

plystra-1.0.0.dev1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file plystra-1.0.0.dev1.tar.gz.

File metadata

  • Download URL: plystra-1.0.0.dev1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for plystra-1.0.0.dev1.tar.gz
Algorithm Hash digest
SHA256 14df4244f538230e5af2aa482dc5302d772a152c783108926d99604fc54f7c50
MD5 db2b33876bf8c74124380182321c1207
BLAKE2b-256 edde3ca97753967f4cab1648c92860d86ffdc92c61bd70e5f3a28a5d8abfc8e4

See more details on using hashes here.

File details

Details for the file plystra-1.0.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: plystra-1.0.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for plystra-1.0.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 4eeaffc55d6ece096ec5a35e25279fa1c1676f24c486cd4d2ecc2cf370bf5e6c
MD5 5e34276cad1d9588fdc7190494efc630
BLAKE2b-256 b5794e105de9cf4daf2003a9b5729e0beeab537e4afa09cfa4c73e504fd5505b

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