The `f5-icontrol-rest` Python library simplifies interaction with the F5 BIG-IP iControl REST API. It manages HTTP sessions (leveraging `requests.Session`), handles URI validation, and provides integrated logging. This generic library is used by other F5 SDKs and projects for programmatic communication with BIG-IP and BIG-IQ devices via the REST API. [1, 4, 5, 7] As of version 1.3.13, the project's GitHub repository is archived and no longer maintained.
Install & Compatibility
Where this runs
tested against v1.3.13 · 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
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 22.6MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.0s · import 0.000s · 23MB
20MB installed
● package 20MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from icontrol.session import iControlRESTSession
This quickstart demonstrates how to establish a session with an F5 BIG-IP device using `iControlRESTSession` and perform a basic GET request to retrieve LTM NAT objects. Ensure to replace placeholder credentials and host with actual values, preferably using environment variables for security. It disables SSL verification for simplicity, which should be avoided in production environments. [1, 5]
import os
from icontrol.session import iControlRESTSession
BIGIP_HOST = os.environ.get('F5_BIGIP_HOST', 'your_bigip_ip_or_hostname')
BIGIP_USER = os.environ.get('F5_BIGIP_USER', 'admin')
BIGIP_PASS = os.environ.get('F5_BIGIP_PASSWORD', 'password')
try:
# Initialize the session
icr_session = iControlRESTSession(BIGIP_USER, BIGIP_PASS, address=BIGIP_HOST)
# Example: Get a list of all LTM NAT objects in Common partition
# Note: For versions < 1.3.13, 'proxies' kwarg only works on method calls, not instantiation.
response = icr_session.get(
f'https://{BIGIP_HOST}/mgmt/tm/ltm/nat',
name='*',
partition='Common',
uri_as_parts=True,
verify=False # Use with caution in production without proper certs
)
print(f"Successfully connected to {BIGIP_HOST}.")
print("LTM NAT objects:")
for item in response.json().get('items', []):
print(f" - Name: {item.get('name')}, Partition: {item.get('partition')}")
except Exception as e:
print(f"An error occurred: {e}")
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.