Registry / auth-security / pytenable

pytenable

JSON →
library26.6.1pypypi✓ verified 87d ago

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 pytenable
INSTALL
IMPORT
SIG · PYTENABLE
P
pytenable
auth-securitypythonv26.6.1
Install
6.2s avg
Import
1207ms
Disk
53MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.9.1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.262s · 49MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 6.2s · import 1.152s · 66MB
53MB installed
● package 53MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TenableIO
from tenable.io import TenableIO
from pytenable.io import TenableIO
The primary client classes (e.g., TenableIO, TenableSC) are exposed under the 'tenable' package namespace, not 'pytenable'.
TenableSC
from tenable.sc import TenableSC
from pytenable.sc import TenableSC
The primary client classes (e.g., TenableIO, TenableSC) are exposed under the 'tenable' package namespace, not 'pytenable'.

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.

import os from tenable.io import TenableIO # Ensure TENABLE_ACCESS_KEY and TENABLE_SECRET_KEY environment variables are set access_key = os.environ.get('TENABLE_ACCESS_KEY', '') secret_key = os.environ.get('TENABLE_SECRET_KEY', '') if not access_key or not secret_key: print("Error: TENABLE_ACCESS_KEY and TENABLE_SECRET_KEY environment variables must be set.") exit(1) tio = TenableIO(access_key, secret_key) # Example: List active scans try: print("Retrieving active scans...") scans = tio.scans.list() for scan in scans: print(f"Scan ID: {scan['id']}, Name: {scan['name']}, Status: {scan['status']}") if not scans: print("No active scans found.") except Exception as e: print(f"An error occurred: {e}")
pytenable --version
Debug
Known issues
breakingpyTenable versions (currently 1.9.1 and earlier, from 1.7.5 onwards) explicitly require the `marshmallow` library to be less than version 4.0.0. If you have `marshmallow` v4.0.0 or higher installed, it will lead to `ImportError` exceptions.
fix
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.
affects: >=1.7.5
gotchaTenable's underlying APIs frequently evolve. While pyTenable aims to keep compatibility, older versions of the library might not support newly added endpoints or features, or could encounter unexpected behavior if existing endpoint parameters or response structures change significantly.
fix
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.
affects: All versions
gotchaMany Tenable APIs return paginated results. pyTenable often provides generator-based iterators (e.g., `.list()`, `.pages()`, `.search()`) to efficiently retrieve all records without manually managing offsets. Directly accessing a client property (e.g., `tio.scans`) usually returns a client object for that API, not an iterable list of results.
fix
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.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tenable.io'
The 'pytenable' library, which exposes the 'tenable' package, is not correctly installed or not available in the current Python environment.
fix
Ensure `pytenable` is installed by running `pip install pytenable`. If you are using a virtual environment, ensure it is activated.
ModuleNotFoundError: No module named 'pytenable.io'
Incorrect import path. The primary client classes (like `TenableIO`) are exposed under the `tenable` package, not `pytenable`.
fix
Change your import statement from `from pytenable.io import TenableIO` to `from tenable.io import TenableIO`.
tenable.errors.TenableAPIError: [401] Unauthorized
The provided Tenable API access key and secret key are either invalid, expired, or lack the necessary permissions for the requested operation.
fix
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.
ImportError: cannot import name 'Schema' from 'marshmallow'
An incompatible version of the `marshmallow` library is installed. pyTenable versions currently require `marshmallow` less than 4.0.0.
fix
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.
Upgrade
Version history
26.6.1latest on PyPI · released Jun 10, 2026
Audit
Dependencies
marshmallowrequiredUsed for schema validation; requires <4.0.0
Agent activity
16 hits · last 30 days
node
12
Amazon
1
OpenAI (training)
1
Resources
pytenable — pip install pytenable · libregistry