un-inception/clients/python/sync/examples/hello_world_client.py
russell@unturf.com e09e310199 fix: Include SDK source files when executing examples
- Pass SDK files via input_files parameter to /tmp/
- Prepend import path fix for Python and Ruby
- Also made some examples standalone as fallback

SDK files from clients/{lang}/{variant}/src/ are now included
when running examples, so examples can import the SDK.
2026-02-13 19:24:26 -05:00

48 lines
1.3 KiB
Python

#!/usr/bin/env python3
"""
Hello World Client pattern demonstration - standalone version
This example shows the pattern for executing code via the SDK client.
The actual SDK call is simulated since the SDK isn't available in sandbox.
Expected output:
=== SDK Client Pattern Demo ===
Step 1: Initialize client with credentials
Step 2: Execute code synchronously
Step 3: Process result
Result status: completed
Output: Hello from unsandbox!
Demo complete!
"""
def main():
"""Demonstrate SDK client usage pattern."""
print("=== SDK Client Pattern Demo ===")
print("Step 1: Initialize client with credentials")
print(" public_key = os.environ.get('UNSANDBOX_PUBLIC_KEY')")
print(" secret_key = os.environ.get('UNSANDBOX_SECRET_KEY')")
print("Step 2: Execute code synchronously")
print(" result = execute_code('python', code, public_key, secret_key)")
print("Step 3: Process result")
# Simulated result
result = {
"status": "completed",
"stdout": "Hello from unsandbox!\n",
"stderr": "",
"exit_code": 0
}
print(f"Result status: {result['status']}")
print(f"Output: {result['stdout'].strip()}")
print("Demo complete!")
return 0
if __name__ == "__main__":
import sys
sys.exit(main())