gbox_sdk.resources.v1 package

Subpackages

Submodules

gbox_sdk.resources.v1.v1 module

class gbox_sdk.resources.v1.v1.AsyncV1Resource(client)

Bases: AsyncAPIResource

property boxes: AsyncBoxesResource
property with_raw_response: AsyncV1ResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: AsyncV1ResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

class gbox_sdk.resources.v1.v1.V1Resource(client)

Bases: SyncAPIResource

property boxes: BoxesResource
property with_raw_response: V1ResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: V1ResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

Module contents

class gbox_sdk.resources.v1.AsyncBoxesResource(client)

Bases: AsyncAPIResource

property actions: AsyncActionsResource
property android: AsyncAndroidResource
property browser: AsyncBrowserResource
async create_android(*, config=NOT_GIVEN, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Create android box

Return type:

AndroidBox

Args:

config: Configuration for a Android box instance

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async create_linux(*, config=NOT_GIVEN, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Create linux box

Return type:

LinuxBox

Args:

config: Configuration for a Linux box instance

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async display(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Retrieve the current display properties for a running box.

This endpoint provides details about the box’s screen resolution, orientation, and other visual properties

Return type:

BoxDisplayResponse

Args:

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async execute_commands(box_id, *, commands, envs=NOT_GIVEN, api_timeout=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Execute a command on a running box.

This endpoint allows you to send commands to the box and receive the output

Return type:

BoxExecuteCommandsResponse

Args:

commands: The command to run. Can be a single string or an array of strings

envs: The environment variables to run the command

api_timeout: The timeout of the command. If the command times out, the exit code will be 124.

For example: ‘timeout 5s sleep 10s’ will result in exit code 124.

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 30s

working_dir: The working directory of the command. It not provided, the command will be run

in the box.config.workingDir directory.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property fs: AsyncFsResource
async list(*, device_type=NOT_GIVEN, labels=NOT_GIVEN, page=NOT_GIVEN, page_size=NOT_GIVEN, status=NOT_GIVEN, type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

List box

Return type:

BoxListResponse

Args:

device_type: Filter boxes by their device type (virtual, physical)

labels: Filter boxes by their labels. Labels are key-value pairs that help identify and

categorize boxes. Use this to filter boxes that match specific label criteria. For example, you can filter by project, environment, team, or any custom labels you’ve added to your boxes.

page: Page number

page_size: Page size

status: Filter boxes by their current status (pending, running, stopped, error,

terminated, all). Must be an array of statuses. Use ‘all’ to get boxes with any status.

type: Filter boxes by their type (linux, android, all). Must be an array of types. Use

‘all’ to get boxes of any type.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async live_view_url(box_id, *, expires_in=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

This endpoint allows you to generate a pre-signed URL for accessing the live view of a running box. The URL is valid for a limited time and can be used to view the box’s live stream

Return type:

BoxLiveViewURLResponse

Args:

expires_in: The live view will be alive for the given duration

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 180m

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async retrieve(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Get box

Return type:

Union[LinuxBox, AndroidBox]

Args:

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async run_code(box_id, *, code, argv=NOT_GIVEN, envs=NOT_GIVEN, language=NOT_GIVEN, api_timeout=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Run code on the box

Return type:

BoxRunCodeResponse

Args:

code: The code to run

argv: The arguments to run the code. For example, if you want to run “python index.py

–help”, you should pass [”–help”] as arguments.

envs: The environment variables to run the code

language: The language of the code.

api_timeout: The timeout of the code execution. If the code execution times out, the exit

code will be 124.

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 30s

working_dir: The working directory of the code. It not provided, the code will be run in the

box.config.workingDir directory.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async start(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Start box

Return type:

Union[LinuxBox, AndroidBox]

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async stop(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Stop box

Return type:

Union[LinuxBox, AndroidBox]

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async terminate(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Terminate a running box.

This action will stop the box and release its resources

Return type:

None

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

async web_terminal_url(box_id, *, expires_in=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

This endpoint allows you to generate a pre-signed URL for accessing the web terminal of a running box. The URL is valid for a limited time and can be used to access the box’s terminal interface

Return type:

BoxWebTerminalURLResponse

Args:

expires_in: The web terminal will be alive for the given duration

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 180m

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property with_raw_response: AsyncBoxesResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: AsyncBoxesResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

class gbox_sdk.resources.v1.AsyncBoxesResourceWithRawResponse(boxes)

Bases: object

property actions: AsyncActionsResourceWithRawResponse
property android: AsyncAndroidResourceWithRawResponse
property browser: AsyncBrowserResourceWithRawResponse
property fs: AsyncFsResourceWithRawResponse
class gbox_sdk.resources.v1.AsyncBoxesResourceWithStreamingResponse(boxes)

Bases: object

property actions: AsyncActionsResourceWithStreamingResponse
property android: AsyncAndroidResourceWithStreamingResponse
property browser: AsyncBrowserResourceWithStreamingResponse
property fs: AsyncFsResourceWithStreamingResponse
class gbox_sdk.resources.v1.AsyncV1Resource(client)

Bases: AsyncAPIResource

property boxes: AsyncBoxesResource
property with_raw_response: AsyncV1ResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: AsyncV1ResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

class gbox_sdk.resources.v1.AsyncV1ResourceWithRawResponse(v1)

Bases: object

property boxes: AsyncBoxesResourceWithRawResponse
class gbox_sdk.resources.v1.AsyncV1ResourceWithStreamingResponse(v1)

Bases: object

property boxes: AsyncBoxesResourceWithStreamingResponse
class gbox_sdk.resources.v1.BoxesResource(client)

Bases: SyncAPIResource

property actions: ActionsResource
property android: AndroidResource
property browser: BrowserResource
create_android(*, config=NOT_GIVEN, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Create android box

Return type:

AndroidBox

Args:

config: Configuration for a Android box instance

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

create_linux(*, config=NOT_GIVEN, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Create linux box

Return type:

LinuxBox

Args:

config: Configuration for a Linux box instance

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

display(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Retrieve the current display properties for a running box.

This endpoint provides details about the box’s screen resolution, orientation, and other visual properties

Return type:

BoxDisplayResponse

Args:

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

execute_commands(box_id, *, commands, envs=NOT_GIVEN, api_timeout=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Execute a command on a running box.

This endpoint allows you to send commands to the box and receive the output

Return type:

BoxExecuteCommandsResponse

Args:

commands: The command to run. Can be a single string or an array of strings

envs: The environment variables to run the command

api_timeout: The timeout of the command. If the command times out, the exit code will be 124.

For example: ‘timeout 5s sleep 10s’ will result in exit code 124.

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 30s

working_dir: The working directory of the command. It not provided, the command will be run

in the box.config.workingDir directory.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property fs: FsResource
list(*, device_type=NOT_GIVEN, labels=NOT_GIVEN, page=NOT_GIVEN, page_size=NOT_GIVEN, status=NOT_GIVEN, type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

List box

Return type:

BoxListResponse

Args:

device_type: Filter boxes by their device type (virtual, physical)

labels: Filter boxes by their labels. Labels are key-value pairs that help identify and

categorize boxes. Use this to filter boxes that match specific label criteria. For example, you can filter by project, environment, team, or any custom labels you’ve added to your boxes.

page: Page number

page_size: Page size

status: Filter boxes by their current status (pending, running, stopped, error,

terminated, all). Must be an array of statuses. Use ‘all’ to get boxes with any status.

type: Filter boxes by their type (linux, android, all). Must be an array of types. Use

‘all’ to get boxes of any type.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

live_view_url(box_id, *, expires_in=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

This endpoint allows you to generate a pre-signed URL for accessing the live view of a running box. The URL is valid for a limited time and can be used to view the box’s live stream

Return type:

BoxLiveViewURLResponse

Args:

expires_in: The live view will be alive for the given duration

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 180m

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

retrieve(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Get box

Return type:

Union[LinuxBox, AndroidBox]

Args:

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

run_code(box_id, *, code, argv=NOT_GIVEN, envs=NOT_GIVEN, language=NOT_GIVEN, api_timeout=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Run code on the box

Return type:

BoxRunCodeResponse

Args:

code: The code to run

argv: The arguments to run the code. For example, if you want to run “python index.py

–help”, you should pass [”–help”] as arguments.

envs: The environment variables to run the code

language: The language of the code.

api_timeout: The timeout of the code execution. If the code execution times out, the exit

code will be 124.

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 30s

working_dir: The working directory of the code. It not provided, the code will be run in the

box.config.workingDir directory.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

start(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Start box

Return type:

Union[LinuxBox, AndroidBox]

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

stop(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Stop box

Return type:

Union[LinuxBox, AndroidBox]

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

terminate(box_id, *, wait=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

Terminate a running box.

This action will stop the box and release its resources

Return type:

None

Args:

wait: Wait for the box operation to be completed, default is true

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

web_terminal_url(box_id, *, expires_in=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)

This endpoint allows you to generate a pre-signed URL for accessing the web terminal of a running box. The URL is valid for a limited time and can be used to access the box’s terminal interface

Return type:

BoxWebTerminalURLResponse

Args:

expires_in: The web terminal will be alive for the given duration

Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 180m

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds

property with_raw_response: BoxesResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: BoxesResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

class gbox_sdk.resources.v1.BoxesResourceWithRawResponse(boxes)

Bases: object

property actions: ActionsResourceWithRawResponse
property android: AndroidResourceWithRawResponse
property browser: BrowserResourceWithRawResponse
property fs: FsResourceWithRawResponse
class gbox_sdk.resources.v1.BoxesResourceWithStreamingResponse(boxes)

Bases: object

property actions: ActionsResourceWithStreamingResponse
property android: AndroidResourceWithStreamingResponse
property browser: BrowserResourceWithStreamingResponse
property fs: FsResourceWithStreamingResponse
class gbox_sdk.resources.v1.V1Resource(client)

Bases: SyncAPIResource

property boxes: BoxesResource
property with_raw_response: V1ResourceWithRawResponse

This property can be used as a prefix for any HTTP method call to return the raw response object instead of the parsed content.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#accessing-raw-response-data-eg-headers

property with_streaming_response: V1ResourceWithStreamingResponse

An alternative to .with_raw_response that doesn’t eagerly read the response body.

For more information, see https://www.github.com/babelcloud/gbox-sdk-py#with_streaming_response

class gbox_sdk.resources.v1.V1ResourceWithRawResponse(v1)

Bases: object

property boxes: BoxesResourceWithRawResponse
class gbox_sdk.resources.v1.V1ResourceWithStreamingResponse(v1)

Bases: object

property boxes: BoxesResourceWithStreamingResponse