Skip to content

Tasks

Get available tasks

Warning

This method may not be available on all sandbox instances. It will be available in future releases.

Use this method to list tasks without the UI API.

Example of getting the last 20 scans (default value)
from ptsandbox import Sandbox, SandboxKey

async def example() -> None:
    key = SandboxKey(...)
    sandbox = Sandbox(key)

    result = await sandbox.get_tasks()
    for task in result.tasks:
        print(task.id, task.name)

ptsandbox.sandbox.sandbox.Sandbox.get_tasks async

get_tasks(
    query: str = "",
    limit: int = 20,
    offset: int = 0,
    utc_offset_seconds: int = 0,
    next_cursor: str | None = None,
) -> SandboxTasksResponse

Get tasks listing

Warning: Unstable API (can be changed in future release)

Parameters:

  • query (str, default: '' ) –

    filtering using the query language. For the syntax, see the user documentation.

    age < 30d AND (task.correlated.state != UNKNOWN ) ORDER BY start desc
    
  • limit (int, default: 20 ) –

    limit on the number of records to be returned

  • utc_offset_seconds (int, default: 0 ) –

    the offset of the user's time from UTC, which will be used for the time in QL queries

  • next_cursor (str | None, default: None ) –

    the value from the previous request

Returns:

Raises:

  • ClientResponseError

    if the server returns an error status

  • ClientError

    on connection or transport errors

  • ValidationError

    if the response body does not match the expected model

ptsandbox.sandbox.api._analysis.AnalysisMixin.get_tasks async

get_tasks(data: dict[str, Any]) -> SandboxTasksResponse

Get tasks listing

Raises:

  • ClientResponseError

    if the server returns an error status

  • ClientError

    on connection or transport errors

  • ValidationError

    if the response body does not match the expected model