Important

The Nessus Package is currently a Technology Preview

Tokens

Methods described in this section relate to the tokens API. These methods can be accessed at Nessus.tokens.

class TokensAPI(api: APISession)[source]
download(token: str, fobj: BytesIO | None = None, chunk_size: int = 1024, stream_hook: Callable[[Response, BytesIO, int], BytesIO] | None = None, hook_kwargs: Dict | None = None) BytesIO[source]

Downloads the specified token download

Parameters:
  • token (str) – The token to download

  • fobj (BytesIO, optional) – The file object to write to. If unspecified, an in-memory object will be created and returned

  • chunk_size (int, optional) – The chunk size to use when writing to the file object. The default is unspecified is 1024 bytes.

  • stream_hook (Callable[Response, BytesIO, int], optional) – If specified, the output will be passed to the stream hook instead of processing ourselves.

  • hook_kwargs (Dict, optional) – Any additional keyword arguments that should be passed on to the stream hook.

Returns:

The file object

Return type:

BytesIO

Example

>>> with open('file.ext', 'wb') as fobj:
...     nessus.tokens.download('1234567890', fobj=fobj)
status(token: str) Dict[source]

Retrieves the status of the specified token

Parameters:

token (str) – The token to check the status of

Returns:

The status response

Return type:

Dict

Example

>>> nessus.tokens.status('1234567890')