Butler API Guide
The Replica Butler subsystem controls secure bi-directional transmission of all data flow in and out of Replica's Virtual Environments. Replica Butler APIs can be accessed in two contexts:
External to Replica, to transfer files to and from external systems
Within a Replica Environment, to move files within Replica, or access files which have been previously uploaded
You can script interactions with Replica Butler using Python. The required package is preinstalled in Linux environments and includes built-in docstrings for inline reference and IDE auto-completion. The Python package README.md additionally lists all available function samples.
Using the API Within an Environment
The scripts below are available in Linux environments and helpful for automating tasks.
Python Examples
Use the preinstalled Python package to interact with Butler from within a Replica environment.
Use Butler Python package in Environment
4.4.0
import sys
sys.path.append('/opt/greymarketlabs/configs/butler')
from butler import ReplicaButler
replicaButler = ReplicaButler()
initialized = replicaButler.initialize()
if initialized:
response = replicaButler.ping()
print(f'Ping response: {response}')
4.5.0
from replica.butler import ReplicaButler
replicaButler = ReplicaButler()
initialized = replicaButler.initialize()
if initialized:
response = replicaButler.ping()
print(f'Ping response: {response}')python3 my-script.pyUsing the API Externally to Replica
Use the Python package to interact with Butler from systems outside of Replica.
Install Package
This will install the Replica Butler Python Wheel with --no-deps flag and into the current working directory via the --target flag.
The code samples presume the Python Requests library is preinstalled in your system, Python venv or equivalent
pip3 install replica_butler-4.4.0-py3-none-any.whl --no-deps --target .Last updated
Was this helpful?