Skip to content

Python client

The Python client library for Orvanta provides a convenient way to interact with the Orvanta platform using Python. This client provides a set of functions and utilities to access Orvanta resources and perform various operations.

To use the Python client library, you need to install the orvanta package via pip:

pip install orvanta

The Python client provides several functions that you can use to interact with the Orvanta platform. Here’s an example of how to use the client to get a resource from Orvanta:

import orvanta
def main():
# Get a resource
db_config = orvanta.get_resource('u/user/db_config')
# Get a variable
api_key = orvanta.get_variable('u/user/api_key')
# Run a script asynchronously
job_id = orvanta.run_script_by_path_async('f/scripts/process_data', args={'input': 'value'})
# Run a script synchronously and get result
result = orvanta.run_script_by_path('f/scripts/calculate', args={'x': 10, 'y': 20})

The client provides both module-level convenience functions and an Orvanta class for advanced usage.

  • get_resource(path) - Get a resource from Orvanta
  • get_variable(path) - Get a variable value
  • set_variable(path, value) - Set a variable value
  • run_script_by_path(path, args) - Run a script synchronously by path
  • run_script_by_hash(hash_, args) - Run a script synchronously by hash
  • run_script_by_path_async(path, args) - Run a script asynchronously by path
  • run_flow_async(path, args) - Run a flow asynchronously
  • get_result(job_id) - Get the result of a completed job
  • get_state() - Get the script’s state
  • set_state(value) - Set the script’s state

For advanced usage, you can instantiate the Orvanta class directly:

from orvanta import Orvanta
client = Orvanta(
base_url='http://localhost:8000',
token='your_token',
workspace='your_workspace')
# Use client methods
result = client.get_resource('u/user/resource')

The client includes helpers for working with S3-compatible storage:

import orvanta
from orvanta import S3Object
# Load a file from S3
s3_obj = S3Object(s3='/path/to/file.txt')
content = orvanta.load_s3_file(s3_obj)
# Write a file to S3
file_content = b'Hello Orvanta!'
orvanta.write_s3_file(s3_obj, file_content)