Skip to main content

Python client library for REGDATA RPS Engine.

Project description

Quick Start Guide rps-engine-client-python

This guide explains how to install and use the rps-engine-client-python library from PyPI to interact with the REGDATA's RPS Engine API.

Install the Library

Install the latest version from PyPI using pip:

pip install rps-engine-client-python

Configure Your Environment

The library requires configuration for authentication and engine connection.

The default location of the configuration file is the root project folder.

Using .Env file with Environment Variables

rps__engineHostName="https://your-rps-engine-url"
rps__identityServiceHostName="https://your-identity-url"
rps__clientId="YOUR_CLIENT_ID"
rps__clientSecret="YOUR_CLIENT_SECRET"
rps__timeout=30

external_source_files__rightsContextsFilePath=path/to/rights_contexts.json
external_source_files__processingContextsFilePath=path/to/processing_contexts.json

rights_contexts.json

{
  "Admin": {
    "evidences": [
      {
        "name": "Role",
        "value": "Admin"
      }
    ]
  }
}

processing_contexts.json

{
  "Protect": {
    "evidences": [
      {
        "name": "Action",
        "value": "Protect"
      }
    ]
  },
  "Deprotect": {
    "evidences": [
      {
        "name": "Action",
        "value": "Deprotect"
      }
    ]
  }
}

Create a Python Script

Below is an example which uses the EngineFactory class for the engine connection, getting the contexts from a JSON file.

  • Pay attention that the given arguments for the rights_context_name and processing_context_name parameters are the names of keys from the rights_contexts.json and processing_contexts.json files above.
from Client.engine.engine_factory import EngineFactory
from Client.context_source import ContextSource
from Client.instance.rps_instance import RPSInstance
from Client.engine_context.processing_context import ProcessingContext
from Client.engine_context.rights_context import RightsContext
from Client.evidence import Evidence
from Client.value.rps_value import RPSValue

engine = EngineFactory.get_engine(context_source=ContextSource.JSON)

raw_first_name = RPSValue(instance=RPSInstance(className='User', propertyName='Name'), originalValue='Jonny')

request_context = engine.create_context().with_request_by_context_names(
    rps_values=[raw_first_name],
    rights_context_name='Admin',
    processing_context_name='Protect')

request_context.transform_async()

print(f'Original: {raw_first_name.original}, Transformed: {raw_first_name.transformed}')

Run Your Script

python your_script.py

Additional Resources

For advanced usage, examples, and contribution guidelines, see the full documentation on GitHub.

For REGDATA Community Page see RPS Community.

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

rps_engine_client_python-1.0.8.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

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

rps_engine_client_python-1.0.8-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file rps_engine_client_python-1.0.8.tar.gz.

File metadata

  • Download URL: rps_engine_client_python-1.0.8.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rps_engine_client_python-1.0.8.tar.gz
Algorithm Hash digest
SHA256 353d9474213422cb7a7a8a3a1b7c564e0427b63fe7555323f9702eb47bfa9d86
MD5 64d0fd906b088fd6587cc6ddfd27286c
BLAKE2b-256 64f9789aef95a381b577001e2d7c7b01e5961275c8ac2d9cccba58c11b6409f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rps_engine_client_python-1.0.8.tar.gz:

Publisher: python-publish.yml on RegdataSA/rps-engine-client-python

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

File details

Details for the file rps_engine_client_python-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for rps_engine_client_python-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 843c1bf30b20aa0d88b391927e07d093e6d486307838e37d82ea844c842b1c18
MD5 035f0350cfa9987e1607c4900df63834
BLAKE2b-256 dd0b3de233d76a2b198edce3847278d13deeec656cdd93c9dd26e508af4566d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rps_engine_client_python-1.0.8-py3-none-any.whl:

Publisher: python-publish.yml on RegdataSA/rps-engine-client-python

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