Export

Methods described in this section relate to the unified export API for TenableOne. These methods can be accessed at TenableOne.inventory.export.

class ExportAPI(api: APISession)[source]
assets(filters: List[PropertyFilter] | None = None, properties: List[str] | None = None, use_readable_name: bool | None = None, max_chunk_file_size: int | None = None, sort_by: str | None = None, sort_direction: SortDirection | None = None, file_format: DatasetFileFormat | None = None) ExportRequestId[source]

Export assets from TenableOne inventory

Parameters:
  • filters (list[PropertyFilter], optional) – A list of filters to apply to the export. Defaults to None.

  • properties (list[str], optional) – Properties to include about the assets returned in the search results. List of property names. Defaults to None.

  • use_readable_name (bool, optional) – If true, the readable name of the property will be used instead of the internal (key) name. Defaults to True.

  • max_chunk_file_size (int, optional) – Maximum size in bytes for each chunk file when exporting large datasets. Defaults to 20971520 (20 MB).

  • sort_by (str, optional) – Field to sort by.

  • sort_direction (SortDirection, optional) – Sorting direction, either SortDirection.ASC or SortDirection.DESC.

  • file_format (DatasetFileFormat, optional) – The file format to be received. If not specified, the default format will be JSON. Supported formats include: CSV and JSON. Defaults to DatasetFileFormat.JSON.

Returns:

The export request ID.

Return type:

ExportRequestId

Examples

>>> export_id = tenable_one.inventory.export.assets(
...     properties=["cpe", "version", "file_location"],
...     sort_by="name",
...     sort_direction=SortDirection.ASC,
...     file_format=DatasetFileFormat.CSV
... )
>>> print(export_id.export_id)
download(export_id: str, chunk_id: str, fobj: BytesIO | None = None) bytes | BytesIO[source]

Download export chunk

Parameters:
  • export_id (str) – The export ID.

  • chunk_id (str) – The chunk ID to download.

  • fobj (BytesIO, optional) – A file-like object to write the downloaded data to. If not provided, the data will be returned as bytes. If provided, the data will be streamed directly to the file object and the file object will be returned.

Returns:

The exported data as bytes if fobj is not provided, or the file object if fobj is provided.

Return type:

Union[bytes, BytesIO]

Examples

Download to bytes: >>> data = tenable_one.inventory.export.download(“export-123”, “0”) >>> with open(“export.csv”, “wb”) as f: … f.write(data)

Stream to file object: >>> with open(“export.csv”, “wb”) as f: … fobj = BytesIO() … tenable_one.inventory.export.download(“export-123”, “0”, fobj) … f.write(fobj.getvalue())

findings(filters: List[PropertyFilter] | None = None, properties: List[str] | None = None, use_readable_name: bool | None = None, max_chunk_file_size: int | None = None, sort_by: str | None = None, sort_direction: SortDirection | None = None, file_format: DatasetFileFormat | None = None) ExportRequestId[source]

Export findings from TenableOne inventory

Parameters:
  • filters (list[PropertyFilter], optional) – A list of filters to apply to the export. Defaults to None.

  • properties (list[str], optional) – Properties to include about the findings returned in the search results. List of property names. Defaults to None.

  • use_readable_name (bool, optional) – If true, the readable name of the property will be used instead of the internal (key) name. Defaults to True.

  • max_chunk_file_size (int, optional) – Maximum size in bytes for each chunk file when exporting large datasets. Defaults to 20971520 (20 MB).

  • sort_by (str, optional) – Field to sort by.

  • sort_direction (SortDirection, optional) – Sorting direction, either SortDirection.ASC or SortDirection.DESC.

  • file_format (DatasetFileFormat, optional) – The file format to be received. If not specified, the default format will be JSON. Supported formats include: CSV and JSON. Defaults to DatasetFileFormat.JSON.

Returns:

The export request ID.

Return type:

ExportRequestId

Examples

>>> export_id = tenable_one.inventory.export.findings(
...     properties=["severity", "status", "created_at"],
...     sort_by="severity",
...     sort_direction=SortDirection.DESC,
...     file_format=DatasetFileFormat.CSV
... )
>>> print(export_id.export_id)
status(export_id: str) ExportRequestStatus[source]

Get export status

Parameters:

export_id (str) – The export ID to check status for.

Returns:

The export status information.

Return type:

ExportRequestStatus

Examples

>>> status = tenable_one.inventory.export.status("export-123")
>>> print(f"Status: {status.status}")
>>> print(f"Chunks available: {status.chunks_available}")