gbox_sdk.resources.v1.boxes package¶
Submodules¶
gbox_sdk.resources.v1.boxes.actions module¶
- class gbox_sdk.resources.v1.boxes.actions.ActionsResource(client)¶
Bases:
SyncAPIResource
- ai(box_id, *, instruction, background=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, settings=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Use natural language instructions to perform UI operations on the box.
You can describe what you want to do in plain language (e.g., ‘click the login button’, ‘scroll down to find settings’, ‘input my email address’), and the AI will automatically convert your instruction into the appropriate UI action and execute it on the box.
- Return type:
Union
[AIActionScreenshotResult
,AIActionResult
]
- Args:
- instruction: Direct instruction of the UI action to perform (e.g., ‘click the login button’,
‘input username in the email field’, ‘scroll down’, ‘swipe left’)
- background: The background of the UI action to perform. The purpose of background is to let
the action executor to understand the context of why the instruction is given including important previous actions and observations
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
settings: AI action settings
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
- click(box_id, *, x, y, button=NOT_GIVEN, double=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Click
- Return type:
- Args:
x: X coordinate of the click
y: Y coordinate of the click
button: Mouse button to click
double: Whether to perform a double click
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- drag(box_id, *, end=NOT_GIVEN, start=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, path=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- extract(box_id, *, instruction, schema=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Extract data from the UI interface using a JSON schema.
- Return type:
ActionExtractResponse
- Args:
instruction: The instruction of the action to extract data from the UI interface
- schema: JSON Schema defining the structure of data to extract. Supports object, array,
string, number, boolean types with validation rules.
Common use cases:
Extract text content: { “type”: “string” }
Extract structured data: { “type”: “object”, “properties”: {…} }
Extract lists: { “type”: “array”, “items”: {…} }
Extract with validation: Add constraints like “required”, “enum”, “pattern”, etc.
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
- move(box_id, *, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Move to position
- Return type:
- Args:
x: X coordinate to move to
y: Y coordinate to move to
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- press_button(box_id, *, buttons, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Press button on the device.
like power button, volume up button, volume down button, etc.
- Return type:
- Args:
buttons: Button to press
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- press_key(box_id, *, keys, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Simulates pressing a specific key by triggering the complete keyboard key event chain (keydown, keypress, keyup). Use this to activate keyboard key event listeners such as shortcuts or form submissions.
- Return type:
- Args:
- keys: This is an array of keyboard keys to press. Supports cross-platform
compatibility.
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- screen_rotation(box_id, *, angle, direction, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rotate screen
- Return type:
- Args:
angle: Rotation angle in degrees
direction: Rotation direction
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
- screenshot(box_id, *, clip=NOT_GIVEN, output_format=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Take screenshot
- Return type:
- Args:
clip: Clipping region for screenshot capture
output_format: Type of the URI. default is base64.
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
- scroll(box_id, *, scroll_x, scroll_y, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Scroll
- Return type:
- Args:
scroll_x: Horizontal scroll amount
scroll_y: Vertical scroll amount
x: X coordinate of the scroll position
y: Y coordinate of the scroll position
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- swipe(box_id, *, direction=NOT_GIVEN, distance=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, end=NOT_GIVEN, start=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- touch(box_id, *, points, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Touch
- Return type:
- Args:
points: Array of touch points and their actions
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- type(box_id, *, text, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Directly inputs text content without triggering physical key events (keydown, etc.), ideal for quickly filling large amounts of text when intermediate input events aren’t needed.
- Return type:
- Args:
text: Text to type
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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: ActionsResourceWithRawResponse¶
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: ActionsResourceWithStreamingResponse¶
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.boxes.actions.AsyncActionsResource(client)¶
Bases:
AsyncAPIResource
- async ai(box_id, *, instruction, background=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, settings=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Use natural language instructions to perform UI operations on the box.
You can describe what you want to do in plain language (e.g., ‘click the login button’, ‘scroll down to find settings’, ‘input my email address’), and the AI will automatically convert your instruction into the appropriate UI action and execute it on the box.
- Return type:
Union
[AIActionScreenshotResult
,AIActionResult
]
- Args:
- instruction: Direct instruction of the UI action to perform (e.g., ‘click the login button’,
‘input username in the email field’, ‘scroll down’, ‘swipe left’)
- background: The background of the UI action to perform. The purpose of background is to let
the action executor to understand the context of why the instruction is given including important previous actions and observations
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
settings: AI action settings
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 click(box_id, *, x, y, button=NOT_GIVEN, double=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Click
- Return type:
- Args:
x: X coordinate of the click
y: Y coordinate of the click
button: Mouse button to click
double: Whether to perform a double click
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- drag(box_id, *, end=NOT_GIVEN, start=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, path=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async extract(box_id, *, instruction, schema=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Extract data from the UI interface using a JSON schema.
- Return type:
ActionExtractResponse
- Args:
instruction: The instruction of the action to extract data from the UI interface
- schema: JSON Schema defining the structure of data to extract. Supports object, array,
string, number, boolean types with validation rules.
Common use cases:
Extract text content: { “type”: “string” }
Extract structured data: { “type”: “object”, “properties”: {…} }
Extract lists: { “type”: “array”, “items”: {…} }
Extract with validation: Add constraints like “required”, “enum”, “pattern”, etc.
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 move(box_id, *, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Move to position
- Return type:
- Args:
x: X coordinate to move to
y: Y coordinate to move to
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 press_button(box_id, *, buttons, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Press button on the device.
like power button, volume up button, volume down button, etc.
- Return type:
- Args:
buttons: Button to press
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 press_key(box_id, *, keys, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Simulates pressing a specific key by triggering the complete keyboard key event chain (keydown, keypress, keyup). Use this to activate keyboard key event listeners such as shortcuts or form submissions.
- Return type:
- Args:
- keys: This is an array of keyboard keys to press. Supports cross-platform
compatibility.
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 screen_rotation(box_id, *, angle, direction, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rotate screen
- Return type:
- Args:
angle: Rotation angle in degrees
direction: Rotation direction
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 screenshot(box_id, *, clip=NOT_GIVEN, output_format=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Take screenshot
- Return type:
- Args:
clip: Clipping region for screenshot capture
output_format: Type of the URI. default is base64.
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 scroll(box_id, *, scroll_x, scroll_y, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Scroll
- Return type:
- Args:
scroll_x: Horizontal scroll amount
scroll_y: Vertical scroll amount
x: X coordinate of the scroll position
y: Y coordinate of the scroll position
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- swipe(box_id, *, direction=NOT_GIVEN, distance=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, end=NOT_GIVEN, start=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async touch(box_id, *, points, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Touch
- Return type:
- Args:
points: Array of touch points and their actions
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 type(box_id, *, text, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Directly inputs text content without triggering physical key events (keydown, etc.), ideal for quickly filling large amounts of text when intermediate input events aren’t needed.
- Return type:
- Args:
text: Text to type
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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: AsyncActionsResourceWithRawResponse¶
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: AsyncActionsResourceWithStreamingResponse¶
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
gbox_sdk.resources.v1.boxes.android module¶
- class gbox_sdk.resources.v1.boxes.android.AndroidResource(client)¶
Bases:
SyncAPIResource
- backup(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup
- Return type:
BinaryAPIResponse
- 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
- backup_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup all
- Return type:
BinaryAPIResponse
- 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
- close(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close app
- Return type:
None
- 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
- close_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close all apps
- Return type:
None
- 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
- get(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg
- Return type:
- 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
- get_app(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get installed app info by package name
- Return type:
- 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
- get_connect_address(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get connect address
- Return type:
- 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
- install(box_id, *, apk, open=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- list_activities(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg activities
- Return type:
- 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
- list_app(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List all installed apps on the launcher
- Return type:
- 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
- list_pkg(box_id, *, pkg_type=NOT_GIVEN, running_filter=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Retrieve detailed information for all installed pkg.
This endpoint provides comprehensive pkg details
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
- running_filter: Filter pkgs by running status: running (show only running pkgs), notRunning
(show only non-running pkgs). Default is all
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
- list_pkg_simple(box_id, *, pkg_type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
A faster endpoint to quickly retrieve basic pkg information.
This API provides better performance for scenarios where you need to get essential pkg details quickly
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
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
- open(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Open app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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
- restart(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restart app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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
- restore(box_id, *, backup, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restore
- Return type:
None
- Args:
backup: Backup file to restore (max file size: 100MB)
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
- uninstall(package_name, *, box_id, keep_data=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Uninstall app
- Return type:
None
- Args:
keep_data: uninstalls the pkg while retaining the data/cache
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: AndroidResourceWithRawResponse¶
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: AndroidResourceWithStreamingResponse¶
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.boxes.android.AsyncAndroidResource(client)¶
Bases:
AsyncAPIResource
- async backup(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup
- Return type:
AsyncBinaryAPIResponse
- 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 backup_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup all
- Return type:
AsyncBinaryAPIResponse
- 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 close(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close app
- Return type:
None
- 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 close_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close all apps
- Return type:
None
- 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 get(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg
- Return type:
- 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 get_app(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get installed app info by package name
- Return type:
- 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 get_connect_address(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get connect address
- Return type:
- 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
- install(box_id, *, apk, open=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async list_activities(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg activities
- Return type:
- 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 list_app(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List all installed apps on the launcher
- Return type:
- 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 list_pkg(box_id, *, pkg_type=NOT_GIVEN, running_filter=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Retrieve detailed information for all installed pkg.
This endpoint provides comprehensive pkg details
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
- running_filter: Filter pkgs by running status: running (show only running pkgs), notRunning
(show only non-running pkgs). Default is all
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 list_pkg_simple(box_id, *, pkg_type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
A faster endpoint to quickly retrieve basic pkg information.
This API provides better performance for scenarios where you need to get essential pkg details quickly
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
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 open(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Open app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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 restart(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restart app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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 restore(box_id, *, backup, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restore
- Return type:
None
- Args:
backup: Backup file to restore (max file size: 100MB)
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 uninstall(package_name, *, box_id, keep_data=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Uninstall app
- Return type:
None
- Args:
keep_data: uninstalls the pkg while retaining the data/cache
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: AsyncAndroidResourceWithRawResponse¶
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: AsyncAndroidResourceWithStreamingResponse¶
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
gbox_sdk.resources.v1.boxes.boxes module¶
- class gbox_sdk.resources.v1.boxes.boxes.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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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.boxes.boxes.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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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
gbox_sdk.resources.v1.boxes.browser module¶
- class gbox_sdk.resources.v1.boxes.browser.AsyncBrowserResource(client)¶
Bases:
AsyncAPIResource
- async cdp_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 Chrome DevTools Protocol (CDP) of a running box. The URL is valid for a limited time and can be used to interact with the box’s browser environment
- Return type:
str
- Args:
expires_in: The CDP url 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: 120m
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: AsyncBrowserResourceWithRawResponse¶
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: AsyncBrowserResourceWithStreamingResponse¶
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.boxes.browser.BrowserResource(client)¶
Bases:
SyncAPIResource
- cdp_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 Chrome DevTools Protocol (CDP) of a running box. The URL is valid for a limited time and can be used to interact with the box’s browser environment
- Return type:
str
- Args:
expires_in: The CDP url 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: 120m
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: BrowserResourceWithRawResponse¶
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: BrowserResourceWithStreamingResponse¶
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
gbox_sdk.resources.v1.boxes.fs module¶
- class gbox_sdk.resources.v1.boxes.fs.AsyncFsResource(client)¶
Bases:
AsyncAPIResource
- async exists(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Check if file/dir exists
- Return type:
Union
[ExistsFileResult
,NotExistsFileResult
]
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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 info(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get file/dir
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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 list(box_id, *, path, depth=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List box files
- Return type:
- Args:
path: Target directory path in the box
depth: Depth of the directory
- working_dir: Working directory. If not provided, the file will be read from 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 read(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Read box file
- Return type:
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file will be
read from the working directory.
- working_dir: Working directory. If not provided, the file will be read from 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 remove(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Delete a file or dir.
If target path is not exists, the delete will be failed.
- Return type:
- Args:
- path: Target path in the box. If the path does not start with ‘/’, the file/directory
will be deleted relative to the working directory. If the target path does not exist, the delete will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 rename(box_id, *, new_path, old_path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rename a file or dir.
If target newPath is already exists, the rename will be failed.
- Args:
- new_path: New path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the newPath already exists, the rename will fail.
- old_path: Old path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the oldPath does not exist, the rename will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 with_raw_response: AsyncFsResourceWithRawResponse¶
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: AsyncFsResourceWithStreamingResponse¶
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
- write(box_id, *, content, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- class gbox_sdk.resources.v1.boxes.fs.FsResource(client)¶
Bases:
SyncAPIResource
- exists(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Check if file/dir exists
- Return type:
Union
[ExistsFileResult
,NotExistsFileResult
]
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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
- info(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get file/dir
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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
- list(box_id, *, path, depth=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List box files
- Return type:
- Args:
path: Target directory path in the box
depth: Depth of the directory
- working_dir: Working directory. If not provided, the file will be read from 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
- read(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Read box file
- Return type:
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file will be
read from the working directory.
- working_dir: Working directory. If not provided, the file will be read from 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
- remove(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Delete a file or dir.
If target path is not exists, the delete will be failed.
- Return type:
- Args:
- path: Target path in the box. If the path does not start with ‘/’, the file/directory
will be deleted relative to the working directory. If the target path does not exist, the delete will fail.
- working_dir: Working directory. If not provided, the file will be read from 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
- rename(box_id, *, new_path, old_path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rename a file or dir.
If target newPath is already exists, the rename will be failed.
- Args:
- new_path: New path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the newPath already exists, the rename will fail.
- old_path: Old path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the oldPath does not exist, the rename will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 with_raw_response: FsResourceWithRawResponse¶
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: FsResourceWithStreamingResponse¶
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
- write(box_id, *, content, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
Module contents¶
- class gbox_sdk.resources.v1.boxes.ActionsResource(client)¶
Bases:
SyncAPIResource
- ai(box_id, *, instruction, background=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, settings=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Use natural language instructions to perform UI operations on the box.
You can describe what you want to do in plain language (e.g., ‘click the login button’, ‘scroll down to find settings’, ‘input my email address’), and the AI will automatically convert your instruction into the appropriate UI action and execute it on the box.
- Return type:
Union
[AIActionScreenshotResult
,AIActionResult
]
- Args:
- instruction: Direct instruction of the UI action to perform (e.g., ‘click the login button’,
‘input username in the email field’, ‘scroll down’, ‘swipe left’)
- background: The background of the UI action to perform. The purpose of background is to let
the action executor to understand the context of why the instruction is given including important previous actions and observations
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
settings: AI action settings
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
- click(box_id, *, x, y, button=NOT_GIVEN, double=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Click
- Return type:
- Args:
x: X coordinate of the click
y: Y coordinate of the click
button: Mouse button to click
double: Whether to perform a double click
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- drag(box_id, *, end=NOT_GIVEN, start=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, path=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- extract(box_id, *, instruction, schema=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Extract data from the UI interface using a JSON schema.
- Return type:
ActionExtractResponse
- Args:
instruction: The instruction of the action to extract data from the UI interface
- schema: JSON Schema defining the structure of data to extract. Supports object, array,
string, number, boolean types with validation rules.
Common use cases:
Extract text content: { “type”: “string” }
Extract structured data: { “type”: “object”, “properties”: {…} }
Extract lists: { “type”: “array”, “items”: {…} }
Extract with validation: Add constraints like “required”, “enum”, “pattern”, etc.
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
- move(box_id, *, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Move to position
- Return type:
- Args:
x: X coordinate to move to
y: Y coordinate to move to
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- press_button(box_id, *, buttons, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Press button on the device.
like power button, volume up button, volume down button, etc.
- Return type:
- Args:
buttons: Button to press
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- press_key(box_id, *, keys, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Simulates pressing a specific key by triggering the complete keyboard key event chain (keydown, keypress, keyup). Use this to activate keyboard key event listeners such as shortcuts or form submissions.
- Return type:
- Args:
- keys: This is an array of keyboard keys to press. Supports cross-platform
compatibility.
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- screen_rotation(box_id, *, angle, direction, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rotate screen
- Return type:
- Args:
angle: Rotation angle in degrees
direction: Rotation direction
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
- screenshot(box_id, *, clip=NOT_GIVEN, output_format=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Take screenshot
- Return type:
- Args:
clip: Clipping region for screenshot capture
output_format: Type of the URI. default is base64.
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
- scroll(box_id, *, scroll_x, scroll_y, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Scroll
- Return type:
- Args:
scroll_x: Horizontal scroll amount
scroll_y: Vertical scroll amount
x: X coordinate of the scroll position
y: Y coordinate of the scroll position
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- swipe(box_id, *, direction=NOT_GIVEN, distance=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, end=NOT_GIVEN, start=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- touch(box_id, *, points, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Touch
- Return type:
- Args:
points: Array of touch points and their actions
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- type(box_id, *, text, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Directly inputs text content without triggering physical key events (keydown, etc.), ideal for quickly filling large amounts of text when intermediate input events aren’t needed.
- Return type:
- Args:
text: Text to type
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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: ActionsResourceWithRawResponse¶
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: ActionsResourceWithStreamingResponse¶
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.boxes.ActionsResourceWithRawResponse(actions)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.ActionsResourceWithStreamingResponse(actions)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AndroidResource(client)¶
Bases:
SyncAPIResource
- backup(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup
- Return type:
BinaryAPIResponse
- 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
- backup_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup all
- Return type:
BinaryAPIResponse
- 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
- close(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close app
- Return type:
None
- 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
- close_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close all apps
- Return type:
None
- 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
- get(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg
- Return type:
- 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
- get_app(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get installed app info by package name
- Return type:
- 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
- get_connect_address(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get connect address
- Return type:
- 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
- install(box_id, *, apk, open=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- list_activities(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg activities
- Return type:
- 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
- list_app(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List all installed apps on the launcher
- Return type:
- 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
- list_pkg(box_id, *, pkg_type=NOT_GIVEN, running_filter=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Retrieve detailed information for all installed pkg.
This endpoint provides comprehensive pkg details
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
- running_filter: Filter pkgs by running status: running (show only running pkgs), notRunning
(show only non-running pkgs). Default is all
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
- list_pkg_simple(box_id, *, pkg_type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
A faster endpoint to quickly retrieve basic pkg information.
This API provides better performance for scenarios where you need to get essential pkg details quickly
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
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
- open(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Open app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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
- restart(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restart app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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
- restore(box_id, *, backup, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restore
- Return type:
None
- Args:
backup: Backup file to restore (max file size: 100MB)
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
- uninstall(package_name, *, box_id, keep_data=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Uninstall app
- Return type:
None
- Args:
keep_data: uninstalls the pkg while retaining the data/cache
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: AndroidResourceWithRawResponse¶
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: AndroidResourceWithStreamingResponse¶
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.boxes.AndroidResourceWithRawResponse(android)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AndroidResourceWithStreamingResponse(android)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncActionsResource(client)¶
Bases:
AsyncAPIResource
- async ai(box_id, *, instruction, background=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, settings=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Use natural language instructions to perform UI operations on the box.
You can describe what you want to do in plain language (e.g., ‘click the login button’, ‘scroll down to find settings’, ‘input my email address’), and the AI will automatically convert your instruction into the appropriate UI action and execute it on the box.
- Return type:
Union
[AIActionScreenshotResult
,AIActionResult
]
- Args:
- instruction: Direct instruction of the UI action to perform (e.g., ‘click the login button’,
‘input username in the email field’, ‘scroll down’, ‘swipe left’)
- background: The background of the UI action to perform. The purpose of background is to let
the action executor to understand the context of why the instruction is given including important previous actions and observations
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
settings: AI action settings
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 click(box_id, *, x, y, button=NOT_GIVEN, double=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Click
- Return type:
- Args:
x: X coordinate of the click
y: Y coordinate of the click
button: Mouse button to click
double: Whether to perform a double click
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- drag(box_id, *, end=NOT_GIVEN, start=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, path=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async extract(box_id, *, instruction, schema=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Extract data from the UI interface using a JSON schema.
- Return type:
ActionExtractResponse
- Args:
instruction: The instruction of the action to extract data from the UI interface
- schema: JSON Schema defining the structure of data to extract. Supports object, array,
string, number, boolean types with validation rules.
Common use cases:
Extract text content: { “type”: “string” }
Extract structured data: { “type”: “object”, “properties”: {…} }
Extract lists: { “type”: “array”, “items”: {…} }
Extract with validation: Add constraints like “required”, “enum”, “pattern”, etc.
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 move(box_id, *, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Move to position
- Return type:
- Args:
x: X coordinate to move to
y: Y coordinate to move to
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 press_button(box_id, *, buttons, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Press button on the device.
like power button, volume up button, volume down button, etc.
- Return type:
- Args:
buttons: Button to press
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 press_key(box_id, *, keys, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Simulates pressing a specific key by triggering the complete keyboard key event chain (keydown, keypress, keyup). Use this to activate keyboard key event listeners such as shortcuts or form submissions.
- Return type:
- Args:
- keys: This is an array of keyboard keys to press. Supports cross-platform
compatibility.
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 screen_rotation(box_id, *, angle, direction, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rotate screen
- Return type:
- Args:
angle: Rotation angle in degrees
direction: Rotation direction
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 screenshot(box_id, *, clip=NOT_GIVEN, output_format=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Take screenshot
- Return type:
- Args:
clip: Clipping region for screenshot capture
output_format: Type of the URI. default is base64.
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 scroll(box_id, *, scroll_x, scroll_y, x, y, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Scroll
- Return type:
- Args:
scroll_x: Horizontal scroll amount
scroll_y: Vertical scroll amount
x: X coordinate of the scroll position
y: Y coordinate of the scroll position
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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
- swipe(box_id, *, direction=NOT_GIVEN, distance=NOT_GIVEN, duration=NOT_GIVEN, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, end=NOT_GIVEN, start=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async touch(box_id, *, points, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Touch
- Return type:
- Args:
points: Array of touch points and their actions
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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 type(box_id, *, text, include_screenshot=NOT_GIVEN, output_format=NOT_GIVEN, screenshot_delay=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Directly inputs text content without triggering physical key events (keydown, etc.), ideal for quickly filling large amounts of text when intermediate input events aren’t needed.
- Return type:
- Args:
text: Text to type
- include_screenshot: Whether to include screenshots in the action response. If false, the screenshot
object will still be returned but with empty URIs. Default is false.
output_format: Type of the URI. default is base64.
screenshot_delay: Delay after performing the action, before taking the final screenshot.
Execution flow:
Take screenshot before action
Perform the action
Wait for screenshotDelay (this parameter)
Take screenshot after action
Example: ‘500ms’ means wait 500ms after the action before capturing the final screenshot.
Supported time units: ms (milliseconds), s (seconds), m (minutes), h (hours) Example formats: “500ms”, “30s”, “5m”, “1h” Default: 500ms Maximum allowed: 30s
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: AsyncActionsResourceWithRawResponse¶
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: AsyncActionsResourceWithStreamingResponse¶
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.boxes.AsyncActionsResourceWithRawResponse(actions)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncActionsResourceWithStreamingResponse(actions)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncAndroidResource(client)¶
Bases:
AsyncAPIResource
- async backup(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup
- Return type:
AsyncBinaryAPIResponse
- 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 backup_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Backup all
- Return type:
AsyncBinaryAPIResponse
- 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 close(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close app
- Return type:
None
- 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 close_all(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Close all apps
- Return type:
None
- 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 get(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg
- Return type:
- 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 get_app(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get installed app info by package name
- Return type:
- 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 get_connect_address(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get connect address
- Return type:
- 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
- install(box_id, *, apk, open=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- async list_activities(package_name, *, box_id, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get pkg activities
- Return type:
- 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 list_app(box_id, *, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List all installed apps on the launcher
- Return type:
- 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 list_pkg(box_id, *, pkg_type=NOT_GIVEN, running_filter=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Retrieve detailed information for all installed pkg.
This endpoint provides comprehensive pkg details
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
- running_filter: Filter pkgs by running status: running (show only running pkgs), notRunning
(show only non-running pkgs). Default is all
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 list_pkg_simple(box_id, *, pkg_type=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
A faster endpoint to quickly retrieve basic pkg information.
This API provides better performance for scenarios where you need to get essential pkg details quickly
- Return type:
- Args:
pkg_type: Package type: system or thirdParty, default is thirdParty
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 open(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Open app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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 restart(package_name, *, box_id, activity_name=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restart app
- Return type:
None
- Args:
activity_name: Activity name, default is the main activity.
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 restore(box_id, *, backup, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Restore
- Return type:
None
- Args:
backup: Backup file to restore (max file size: 100MB)
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 uninstall(package_name, *, box_id, keep_data=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Uninstall app
- Return type:
None
- Args:
keep_data: uninstalls the pkg while retaining the data/cache
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: AsyncAndroidResourceWithRawResponse¶
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: AsyncAndroidResourceWithStreamingResponse¶
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.boxes.AsyncAndroidResourceWithRawResponse(android)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncAndroidResourceWithStreamingResponse(android)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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.boxes.AsyncBoxesResourceWithRawResponse(boxes)¶
Bases:
object
- property actions: AsyncActionsResourceWithRawResponse¶
- property android: AsyncAndroidResourceWithRawResponse¶
- property browser: AsyncBrowserResourceWithRawResponse¶
- property fs: AsyncFsResourceWithRawResponse¶
- class gbox_sdk.resources.v1.boxes.AsyncBoxesResourceWithStreamingResponse(boxes)¶
Bases:
object
- property actions: AsyncActionsResourceWithStreamingResponse¶
- property android: AsyncAndroidResourceWithStreamingResponse¶
- property browser: AsyncBrowserResourceWithStreamingResponse¶
- property fs: AsyncFsResourceWithStreamingResponse¶
- class gbox_sdk.resources.v1.boxes.AsyncBrowserResource(client)¶
Bases:
AsyncAPIResource
- async cdp_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 Chrome DevTools Protocol (CDP) of a running box. The URL is valid for a limited time and can be used to interact with the box’s browser environment
- Return type:
str
- Args:
expires_in: The CDP url 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: 120m
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: AsyncBrowserResourceWithRawResponse¶
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: AsyncBrowserResourceWithStreamingResponse¶
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.boxes.AsyncBrowserResourceWithRawResponse(browser)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncBrowserResourceWithStreamingResponse(browser)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncFsResource(client)¶
Bases:
AsyncAPIResource
- async exists(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Check if file/dir exists
- Return type:
Union
[ExistsFileResult
,NotExistsFileResult
]
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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 info(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get file/dir
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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 list(box_id, *, path, depth=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List box files
- Return type:
- Args:
path: Target directory path in the box
depth: Depth of the directory
- working_dir: Working directory. If not provided, the file will be read from 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 read(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Read box file
- Return type:
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file will be
read from the working directory.
- working_dir: Working directory. If not provided, the file will be read from 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 remove(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Delete a file or dir.
If target path is not exists, the delete will be failed.
- Return type:
- Args:
- path: Target path in the box. If the path does not start with ‘/’, the file/directory
will be deleted relative to the working directory. If the target path does not exist, the delete will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 rename(box_id, *, new_path, old_path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rename a file or dir.
If target newPath is already exists, the rename will be failed.
- Args:
- new_path: New path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the newPath already exists, the rename will fail.
- old_path: Old path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the oldPath does not exist, the rename will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 with_raw_response: AsyncFsResourceWithRawResponse¶
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: AsyncFsResourceWithStreamingResponse¶
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
- write(box_id, *, content, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- class gbox_sdk.resources.v1.boxes.AsyncFsResourceWithRawResponse(fs)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.AsyncFsResourceWithStreamingResponse(fs)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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.boxes.BoxesResourceWithRawResponse(boxes)¶
Bases:
object
- property actions: ActionsResourceWithRawResponse¶
- property android: AndroidResourceWithRawResponse¶
- property browser: BrowserResourceWithRawResponse¶
- property fs: FsResourceWithRawResponse¶
- class gbox_sdk.resources.v1.boxes.BoxesResourceWithStreamingResponse(boxes)¶
Bases:
object
- property actions: ActionsResourceWithStreamingResponse¶
- property android: AndroidResourceWithStreamingResponse¶
- property browser: BrowserResourceWithStreamingResponse¶
- property fs: FsResourceWithStreamingResponse¶
- class gbox_sdk.resources.v1.boxes.BrowserResource(client)¶
Bases:
SyncAPIResource
- cdp_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 Chrome DevTools Protocol (CDP) of a running box. The URL is valid for a limited time and can be used to interact with the box’s browser environment
- Return type:
str
- Args:
expires_in: The CDP url 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: 120m
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: BrowserResourceWithRawResponse¶
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: BrowserResourceWithStreamingResponse¶
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.boxes.BrowserResourceWithRawResponse(browser)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.BrowserResourceWithStreamingResponse(browser)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.FsResource(client)¶
Bases:
SyncAPIResource
- exists(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Check if file/dir exists
- Return type:
Union
[ExistsFileResult
,NotExistsFileResult
]
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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
- info(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Get file/dir
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file/directory
will be checked relative to the working directory
- working_dir: Working directory. If not provided, the file will be read from 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
- list(box_id, *, path, depth=NOT_GIVEN, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
List box files
- Return type:
- Args:
path: Target directory path in the box
depth: Depth of the directory
- working_dir: Working directory. If not provided, the file will be read from 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
- read(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Read box file
- Return type:
- Args:
path: Target path in the box.
- If the path does not start with ‘/’, the file will be
read from the working directory.
- working_dir: Working directory. If not provided, the file will be read from 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
- remove(box_id, *, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Delete a file or dir.
If target path is not exists, the delete will be failed.
- Return type:
- Args:
- path: Target path in the box. If the path does not start with ‘/’, the file/directory
will be deleted relative to the working directory. If the target path does not exist, the delete will fail.
- working_dir: Working directory. If not provided, the file will be read from 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
- rename(box_id, *, new_path, old_path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
Rename a file or dir.
If target newPath is already exists, the rename will be failed.
- Args:
- new_path: New path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the newPath already exists, the rename will fail.
- old_path: Old path in the box. If the path does not start with ‘/’, the file/directory
will be renamed relative to the working directory. If the oldPath does not exist, the rename will fail.
- working_dir: Working directory. If not provided, the file will be read from 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 with_raw_response: FsResourceWithRawResponse¶
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: FsResourceWithStreamingResponse¶
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
- write(box_id, *, content, path, working_dir=NOT_GIVEN, extra_headers=None, extra_query=None, extra_body=None, timeout=NOT_GIVEN)¶
- Return type:
- class gbox_sdk.resources.v1.boxes.FsResourceWithRawResponse(fs)¶
Bases:
object
- class gbox_sdk.resources.v1.boxes.FsResourceWithStreamingResponse(fs)¶
Bases:
object