Skip to content

Latest commit

 

History

History
2164 lines (1489 loc) · 21.5 KB

reference.md

File metadata and controls

2164 lines (1489 loc) · 21.5 KB

Reference

client.start(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.start()

⚙️ Parameters

instance_type: typing.Optional[DeploymentConfigInstanceType]

timeout_hours: typing.Optional[float]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.get(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.get(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Instance

client.instance.screenshot(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.screenshot(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.get_stream_url(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.get_stream_url(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.computer(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.computer(
    instance_id="instance_id",
    action="key",
)

⚙️ Parameters

instance_id: str

action: Action

coordinate: typing.Optional[typing.Sequence[int]]

text: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.bash(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.bash(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

command: typing.Optional[str]

restart: typing.Optional[bool]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.edit(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.edit(
    instance_id="instance_id",
    command="view",
    path="path",
)

⚙️ Parameters

instance_id: str

command: Command

path: str

file_text: typing.Optional[str]

view_range: typing.Optional[typing.Sequence[int]]

old_str: typing.Optional[str]

new_str: typing.Optional[str]

insert_line: typing.Optional[int]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.stop(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.stop(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.pause(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.pause(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.instance.resume(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.instance.resume(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

timeout_hours: typing.Optional[float]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Agent

client.agent.act(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.agent.act(
    instance_id="instance_id",
    cmd="cmd",
)

⚙️ Parameters

instance_id: str

cmd: str

include_screenshot: typing.Optional[bool]

model: typing.Optional[Model]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.agent.scrape(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.agent.scrape(
    instance_id="instance_id",
    cmd="cmd",
)

⚙️ Parameters

instance_id: str

cmd: str

schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

include_screenshot: typing.Optional[bool]

model: typing.Optional[Model]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Browser

client.browser.start(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.browser.start(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.browser.get_cdp_url(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.browser.get_cdp_url(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.browser.authenticate(...)

📝 Description

Authenticate browser with Anon for all available apps

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.browser.authenticate(
    instance_id="instance_id",
    context_id="context_id",
)

⚙️ Parameters

instance_id: str

context_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.browser.stop(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.browser.stop(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Code

client.code.execute(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.code.execute(
    instance_id="instance_id",
    code="code",
)

⚙️ Parameters

instance_id: str

code: str

kernel_name: typing.Optional[str]

timeout: typing.Optional[int]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Notebook

client.notebook.list_kernels(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.list_kernels(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.create(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.create(
    instance_id="instance_id",
    name="name",
)

⚙️ Parameters

instance_id: str

name: str

kernel_name: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.get(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.get(
    instance_id="instance_id",
    notebook_id="notebook_id",
)

⚙️ Parameters

instance_id: str

notebook_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.delete(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.delete(
    instance_id="instance_id",
    notebook_id="notebook_id",
)

⚙️ Parameters

instance_id: str

notebook_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.add_cell(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.add_cell(
    instance_id="instance_id",
    notebook_id="notebook_id",
    type="code",
    content="content",
)

⚙️ Parameters

instance_id: str

notebook_id: str

type: CellType

content: str

metadata: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.execute_cell(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.execute_cell(
    instance_id="instance_id",
    notebook_id="notebook_id",
    cell_id="cell_id",
)

⚙️ Parameters

instance_id: str

notebook_id: str

cell_id: str

timeout: typing.Optional[int]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.notebook.execute(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.notebook.execute(
    instance_id="instance_id",
    notebook_id="notebook_id",
)

⚙️ Parameters

instance_id: str

notebook_id: str

timeout: typing.Optional[int]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

File

client.file.read(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.file.read(
    instance_id="instance_id",
    path="path",
)

⚙️ Parameters

instance_id: str

path: str

encoding: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.file.write(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.file.write(
    instance_id="instance_id",
    path="path",
    content="content",
)

⚙️ Parameters

instance_id: str

path: str

content: str

encoding: typing.Optional[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.file.upload(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.file.upload(
    instance_id="instance_id",
    path="path",
    content="content",
)

⚙️ Parameters

instance_id: str

path: str

content: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.file.download(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.file.download(
    instance_id="instance_id",
    path="path",
)

⚙️ Parameters

instance_id: str

path: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

Env

client.env.get(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.env.get(
    instance_id="instance_id",
)

⚙️ Parameters

instance_id: str

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.env.set(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.env.set(
    instance_id="instance_id",
    variables={"key": "value"},
)

⚙️ Parameters

instance_id: str

variables: typing.Dict[str, str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.

client.env.delete(...)

🔌 Usage

from scrapybara import Scrapybara

client = Scrapybara(
    api_key="YOUR_API_KEY",
)
client.env.delete(
    instance_id="instance_id",
    keys=["keys"],
)

⚙️ Parameters

instance_id: str

keys: typing.Sequence[str]

request_options: typing.Optional[RequestOptions] — Request-specific configuration.