Skip to main content

Python Open Policy Agent (OPA) Client

See offical documentation page Open Policy Agent

>>> from opa_client.opa import OpaClient
>>> client = OpaClient() # default host='localhost', port=8181, version='v1'
>>> print(client.check_connection())
True
>>>  test_policy = """
...     package play
... 
...     import data.testapi.testdata
... 
...     default hello = false
... 
...     hello {
...         m := input.message
...         testdata[i] == "world"
...     }
... """

>>> print(client.update_opa_policy_fromstring(test_policy, "testpolicy"))
True
>>> print(client.get_policies_list())
['testpolicy']
>>> data = ["world", "hello"]
>>> print(client.update_or_create_opa_data(data, "testapi/testdata"))
True
>>> check_data = {"input": {"message": "hello"}}
>>> print(client.check_permission(input_data=check_data, policy_name="testpolicy", rule_name="hello"))
{'result': True}

OPA-python-client supports Python >= 3.6

Metadata

Release files for opa-python-client 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opa-python-client 1.0.1
File Size Uploaded Provenance Actions
OPA-python-client-1.0.1.tar.gz 4.3 kB Without provenance Details for OPA-python-client-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opa-python-client 1.0.1
File Interpreter ABI Platform Actions
OPA_python_client-1.0.1-py3-none-any.whl Python 3 none any Details for OPA_python_client-1.0.1-py3-none-any.whl

Total release size: 10.3 kB

Release files / OPA-python-client-1.0.1.tar.gz

Download URL OPA-python-client-1.0.1.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
f81f6440bb9f89daa0aa71033dc1434a80867a7ead99871ac5d2d251f8ea2768
BLAKE2b-256 checksum
How to use checksums
b6fc91c7d25501b233eb10c3e13846c63a43f8b4f4f1f08f75dc132a5151e589
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.3

Release files / OPA_python_client-1.0.1-py3-none-any.whl

Download URL OPA_python_client-1.0.1-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6eebed8c4e6d81ec904c3a70dc18908b0cd71da78f9b0d78c6d4789b8ec9f4b3
BLAKE2b-256 checksum
How to use checksums
850ea6c036852b663d2f7c0173240958c18255cddeb2b1d533b8b99a92a111de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.3

Security for opa-python-client 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page