pyTenable is the official Python library for interacting with Tenable's cybersecurity platforms, including Tenable.io and Tenable.sc. It provides a convenient, object-oriented interface to the various APIs, simplifying common tasks like vulnerability management, asset discovery, and compliance checks. The library is actively maintained, with frequent minor and patch releases to support new API features and address issues; its current version is 1.9.1.
pip install pytenableVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes a Tenable.io client using environment variables for authentication and then lists all active scans. It demonstrates the basic structure for interacting with Tenable.io APIs through the `TenableIO` object.
Ensure `marshmallow` is installed at a version less than 4.0.0 (e.g., `pip install "marshmallow<4.0.0"`). It is recommended to use a virtual environment to manage dependencies and avoid conflicts.
Regularly update pyTenable to the latest stable version to ensure compatibility with the most current Tenable APIs. Always review the changelog before updating to understand any potential impact on your existing code.
For endpoints that support pagination, use the provided list/pages/search methods (e.g., `tio.scans.list()`, `tio.assets.pages()`, `tio.vulnerabilities.search()`) to retrieve iterable results.
Ensure `pytenable` is installed by running `pip install pytenable`. If you are using a virtual environment, ensure it is activated.
Change your import statement from `from pytenable.io import TenableIO` to `from tenable.io import TenableIO`.
Verify that your `TENABLE_ACCESS_KEY` and `TENABLE_SECRET_KEY` environment variables (or direct parameters) are correct and correspond to valid API keys with the required permissions in Tenable.io or Tenable.sc.
Downgrade `marshmallow` to a compatible version using `pip install "marshmallow<4.0.0"`. It is highly recommended to use a virtual environment to manage dependencies and avoid conflicts.