from gravixlayer import GravixLayer
client = GravixLayer() # defaults to cloud="aws", region="us-east-1"
sandbox = client.runtime.create() # defaults to template="base-small"
session = sandbox.pty.create(cols=120, rows=40)
sandbox.pty.send_input(session.session_id, "python3\n")
sandbox.pty.send_input(session.session_id, "2 ** 100\n")
for event in sandbox.pty.stream(session.session_id):
if event["type"] == "data":
text = event["data"].decode("utf-8", "replace")
print(text, end="")
if ">>>" in text and "1267650600228229401496703205376" in text:
break
sandbox.pty.kill(session.session_id)
sandbox.kill()