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.7.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.7-py3-none-any.whl (41.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rps_engine_client_python-1.0.7.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.7.tar.gz
Algorithm Hash digest
SHA256 6409d829ad0f4d059d5e0aeca034c9a1defe7f5030c187cfb8f89a03f58c937c
MD5 b6a39691f7d72d8810d1e8695fb2385d
BLAKE2b-256 156d8bf5dad36220f86a068fdaae152f283719e0efecfec38a66009fcabc1c73

See more details on using hashes here.

Provenance

The following attestation bundles were made for rps_engine_client_python-1.0.7.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.7-py3-none-any.whl.

File metadata

File hashes

Hashes for rps_engine_client_python-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 17326a9580f3b3bb59886e182381f770041087b8258644eb58c485f6cc754293
MD5 0f602fb1a1c1d4ee42717356d0d742c1
BLAKE2b-256 71da736f1c53d5676ffea3555c3c021e3f5111f067a80cac7a4c8b7317edc19c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rps_engine_client_python-1.0.7-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