Skip to content

Download data

The read() method returns a bytes object.

from agentbox import Sandbox

sandbox = Sandbox(
    api_key="ab_xxxxxxxxxxxxxxxxxxxxxxxxx",
    template="wemmodr8mb2uk3kn7exw",
    timeout=120
)

# Read file from sandbox (returns bytes)
content = sandbox.files.read('/path/in/sandbox')

# Write file to local filesystem in binary mode
with open('/local/path', 'wb') as file:
    file.write(content)