1from scrapybara import Scrapybara23client = Scrapybara(api_key="your_api_key")4instance = client.start_ubuntu()
1result = instance.code.execute(2 code="print('Hello from Scrapybara!')",3 kernel_name="python3" # Optional: specify kernel4)
1kernels = instance.notebook.list_kernels()
1notebook = instance.notebook.create(2 name="my_notebook",3 kernel_name="python3"4)
1# 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)
1# Execute all cells in the notebook2results = instance.notebook.execute(notebook_id=notebook.id)
1# Delete the notebook when done2instance.notebook.delete(notebook_id=notebook.id)