ProtocolsCode ExecutionExecute code in your Scrapybara instancePythonTypeScript1Start an instance1from scrapybara import Scrapybara23client = Scrapybara(api_key="your_api_key")4instance = client.start(instance_type="small")2Execute code directly1result = instance.code.execute(2 code="print('Hello from Scrapybara!')",3 kernel_name="python3" # Optional: specify kernel4)3List available kernels1kernels = instance.notebook.list_kernels()4Create a notebook1notebook = instance.notebook.create(2 name="my_notebook",3 kernel_name="python3"4)5Add and execute cells1# Add a code cell2cell = instance.notebook.add_cell(3 notebook_id=notebook.id,4 type="code",5 content="print('Hello from Scrapybara!')"6)78# Execute the cell9result = instance.notebook.execute_cell(10 notebook_id=notebook.id,11 cell_id=cell.id12)6Execute entire notebook1# Execute all cells in the notebook2results = instance.notebook.execute(notebook_id=notebook.id)7Clean up1# Delete the notebook when done2instance.notebook.delete(notebook_id=notebook.id)Built with