query module

Provides JupiterOne query wrappers.

class hutch.security.jupiterone.query.Client(account: str, token: str, api_url: str = 'https://api.us.jupiterone.io')[source]

Bases: object

Provides a JupiterOne query client.

deferred(query: str, cursor: str = '', include_deleted: bool = False) hutch.security.jupiterone.models.DeferredQuery[source]

Performs a deferred query, returning a deferred query object.

Parameters
  • query – The JupiterOne query to execute.

  • cursor – The cursor for the next page of results to fetch, returned from a previous query.

  • include_deleted – Whether to include ‘recently deleted’ objects from JupiterOne.

Returns

A deferred query object.

deferred_status(status_url: str) hutch.security.jupiterone.models.DeferredQueryStatus[source]

Returns the status of a deferred query.

Parameters

status_url – The status URL of the deferred query.

Returns

A deferred query status object.

perform(query: str, interval: int = 5, timeout: int = 300, include_deleted: bool = False) Iterable[hutch.security.jupiterone.models.QueryResponse][source]

Perform a query and page over results until there are none left.

Parameters
  • query – The JupiterOne query to execute.

  • timeout – The maximum time to wait for results (in seconds).

  • interval – The time to wait between requests to the API to check query status, in seconds.

  • include_deleted – Whether to include ‘recently deleted’ objects from JupiterOne.

This is the simplest way to use this library, as results will be returned until no more results are available.

query(query: str, cursor: str = '', interval: int = 5, timeout: int = 300, include_deleted: bool = False) hutch.security.jupiterone.models.QueryResponse[source]

Syncronously performs a JupiterOne search, returning a response object.

Parameters
  • query – The JupiterOne query to execute.

  • cursor – The cursor to use when retrieving results, used for pagination.

  • timeout – The maximum time to wait for results (in seconds).

  • interval – The time to wait between requests to the API to check query status, in seconds.

  • include_deleted – Whether to include ‘recently deleted’ objects from JupiterOne.

Returns

A Query response object.