Skip to main content

IP Fabric

IPFabric is a Python module for connecting to and communicating against an IP Fabric instance.

For full documentation please see IP Fabric Documentation Portal.

IP Fabric

IP Fabric is a vendor-neutral network assurance platform that automates the holistic discovery, verification, visualization, and documentation of large-scale enterprise networks, reducing the associated costs and required resources whilst improving security and efficiency.

It supports your engineering and operations teams, underpinning migration and transformation projects. IP Fabric will revolutionize how you approach network visibility and assurance, security assurance, automation, multi-cloud networking, and trouble resolution.

Integrations or scripts should not be installed directly on the IP Fabric VM unless directly communicated from the IP Fabric Support or Solution Architect teams. Any action on the Command-Line Interface (CLI) using the root, osadmin, or autoboss account may cause irreversible, detrimental changes to the product and can render the system unusable.

Bugs

A bug has been identified when ~2,000 requests are being made to the API. The underlining issue seems to be with the implementation of http2. The workaround is to set http2=False in the IPFClient class. Example error:

httpx.RemoteProtocolError: <ConnectionTerminated error_code:ErrorCodes.NO_ERROR, last_stream_id:1999, additional_data:None>

Notices

Please note IP Fabric's new API Versioning Policy.

IP Fabric team is migrating from httpx to niquests in IP Fabric SDK v7.5.0. This is outside of a major release however the IP Fabric version 7.5.0 will include our new database and will require through testing to ensure compatibility.

This should not impact any existing automations unless you are using httpx Client in your code. This is a private attribute of the IP Fabric IPFClient class. The HTTP method functions did not appear to require any changes so using IPFClient().get(), IPFClient().post(), etc. will continue to work as expected we expect.

Reasons:

  • Our team has opened an issue with httpx to address the bug above and have not received any support after 10 months.
  • Last release of httpx was in December 2024 compared to niquests which has more frequent releases.
  • Lacks many features compared to niquests.
  • Will enable our team to explore HTTP2 multiplexing API requests.
  • niquests is a maintained fork of requests so should be familiar to most Python users.

Niquests Features

v8.0.0 Breaking Changes (released)

Python 3.10+ Required

Python 3.9 (End of Life 2025-10) has been removed. Minimum supported version is Python 3.10.

Python 3.10 reaches End of Life in October 2026 and Python 3.11 in October 2027. For new deployments, prefer Python 3.12+ where possible.

Moved Models

Legacy import paths removed in v8.0.0:

  • ipfabric.settings.vendor_api_models.* -> ipfabric.models.vendor_api
  • ipfabric.settings.discovery.Networks -> ipfabric.models.discovery.Networks
  • ipfabric.settings.seeds.SeedList -> ipfabric.models.discovery.SeedList
  • ipfabric.settings.authentication.[Credential, CredentialList, Privilege, PrivilegeList] -> ipfabric.models.authentication

Login IP Removed

The loginIp API column and Device.login_ip field have been removed. Use login_ipv4 and login_ipv6 instead.

Versioning

Please note IP Fabric's new API Versioning Policy.

Semantic Versioning: Major.Minor.Patch

Starting with IP Fabric version 5.0.x the ipfabric SDK is recommended to match your IP Fabric major and minor version.
We will try to keep some backwards compatability (SDK version 6.9.x should work with IP Fabric API 6.8) however new features may break some functionality. By ensuring that your ipfabric SDK's match your IP Fabric major and minor
version will ensure compatibility and will continue to work.

The Patch version of the SDK is used for bug fixes and new features that are compatible with the major and minor version.

Defaulted to Streaming Data

See Notices for full information.

  • GET URL is limited to 4096 characters.
    • Complex queries and filters could go over this limit; however in testing it was very difficult to reach this.
  • CSV Export
    • Only supported with a streaming GET request and return a bytes string of data in the Python SDK.
    • It will also convert times to human-readable format.
    • reports (returning Intent Check data) is not supported with CSV export, however is required when filtering based on Intents (colors).
from ipfabric import IPFClient
ipf = IPFClient(streaming=True)

dev = ipf.inventory.devices.all()
print(type(dev))  # list 

dev_csv = ipf.fetch_all('tables/inventory/devices', export='csv')
print(type(dev_csv))  # bytes 

# Timezone can be changed for CSV export; see `ipfabric.tools.shared.TIMEZONES`
dev_csv_tz = ipf.inventory.devices.all(export='csv', csv_tz='UTC')

# If specifying to return reports and CSV request will drop reports input and use GET
dev_csv_reports = ipf.fetch_all('tables/inventory/devices', reports=True, export='csv')
"""CSV export does not return reports, parameter has been excluded."""
print(type(dev_csv_reports))  # bytes

# If URL exceeds 4096 characters the following exception will be raised:
# raise InvalidURL(f"URL exceeds max character limit of 4096: length={len(url)}.")

Installation

pip install ipfabric

To use export='df' on some methods please install pandas with ipfabric

pip install ipfabric[pd]

Introduction

Please take a look at API Programmability - Part 1: The Basics for instructions on creating an API token.

Most of the methods and features can be located in Examples to show how to use this package. Another great introduction to this package can be found at API Programmability - Part 2: Python

Authentication

Username/Password

Supply in client:

from ipfabric import IPFClient
ipf = IPFClient('https://demo3.ipfabric.io/', auth=('user', 'pass'))

Token

from ipfabric import IPFClient
ipf = IPFClient('https://demo3.ipfabric.io/', auth='token')

Environment

The easiest way to use this package is with a .env file. You can copy the sample and edit it with your environment variables.

cp sample.env .env

This contains the following variables which can also be set as environment variables instead of a .env file.

IPF_URL="https://demo3.ipfabric.io"
IPF_TOKEN=TOKEN
IPF_VERIFY=true

Or if using Username/Password:

IPF_URL="https://demo3.ipfabric.io"
IPF_USERNAME=USER
IPF_PASSWORD=PASS

Development

Poetry Installation

IPFabric uses Poetry to make setting up a virtual environment with all dependencies installed quick and easy.

Install poetry globally:

pip install poetry

To install a virtual environment run the following command in the root of this directory.

poetry install

To run examples, install extras:

poetry install ipfabric -E examples

Test and Build

poetry run pytest
poetry build

Prior to pushing changes run:

poetry run black ipfabric
poetry update

Release files for ipfabric 8.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ipfabric 8.0.1
File Size Uploaded
ipfabric-8.0.1.tar.gz 259.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ipfabric 8.0.1
File Interpreter ABI Platform
ipfabric-8.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 568.2 kB

Release files / ipfabric-8.0.1.tar.gz

Download URL ipfabric-8.0.1.tar.gz
Size 259.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0bd7d14b07b2f0eda8036dd1ea0e6da63d4b8eeea905020b83bc1576fed80447
BLAKE2b-256 checksum
How to use checksums
0c232db3289d998226242b900f3f801830e0020c9d6ad6d53593989914a53841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via poetry/2.4.3 CPython/3.12.14 Linux/6.12.107+deb13-amd64

Release files / ipfabric-8.0.1-py3-none-any.whl

Download URL ipfabric-8.0.1-py3-none-any.whl
Size 308.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70710b3db338aef14747ee9ae03e2f83353d91446094f77c85528622fa14b933
BLAKE2b-256 checksum
How to use checksums
87e7a080639122e1eca28dc69f790898df0eea802df48db959b2859de0c19f0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via poetry/2.4.3 CPython/3.12.14 Linux/6.12.107+deb13-amd64

Release history Release notifications | RSS feed

This release

8.0.1 This release

2 release files

8.0.0

2 release files

7.12.0

2 release files

7.11.2

2 release files

7.11.1

2 release files

7.11.0

2 release files

7.10.0

2 release files

7.9.1

2 release files

7.9.0

2 release files

7.8.2

2 release files

7.8.1

2 release files

7.8.0

2 release files

7.5.2

2 release files

7.5.1

2 release files

7.5.0

2 release files

7.3.1

2 release files

7.3.0

2 release files

7.2.2

2 release files

7.2.1

2 release files

7.2.0

2 release files

7.0.3

2 release files

7.0.2

2 release files

7.0.1

2 release files

6.10.7

2 release files

6.10.6

2 release files

6.10.4

2 release files

6.10.1

2 release files

6.10.0

2 release files

6.9.9

2 release files

6.9.8

2 release files

6.9.7

2 release files

6.9.6

2 release files

6.9.5

2 release files

6.9.4

2 release files

6.9.3

2 release files

6.9.2

2 release files

6.9.1

2 release files

6.9.0

2 release files

6.8.3

2 release files

6.8.2

2 release files

6.8.1

2 release files

6.8.0

2 release files

6.7.3

2 release files

6.7.2

2 release files

6.7.1

2 release files

6.7.0

2 release files

6.6.4

2 release files

6.6.3

2 release files

6.6.2

2 release files

6.6.1

2 release files

6.6.0

2 release files

6.5.4

2 release files

6.5.3

2 release files

6.5.2

2 release files

6.5.1

2 release files

6.5.0

2 release files

6.4.2

2 release files

6.4.1

2 release files

6.4.0

2 release files

6.3.2

2 release files

6.3.1

2 release files

6.3.0

2 release files

6.2.5

2 release files

6.2.4

2 release files

6.2.3

2 release files

6.2.2

2 release files

6.2.1

2 release files

6.2.0

2 release files

6.1.1

2 release files

6.1.0

2 release files

6.0.10

2 release files

6.0.9

2 release files

6.0.8

2 release files

6.0.7

2 release files

6.0.6

2 release files

6.0.5

2 release files

6.0.4

2 release files

6.0.3

2 release files

6.0.2

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.0.12

2 release files

5.0.11

2 release files

5.0.10

2 release files

5.0.9

2 release files

5.0.8

2 release files

5.0.7

2 release files

5.0.6

2 release files

5.0.5

2 release files

5.0.4

2 release files

5.0.3

2 release files

5.0.2

2 release files

5.0.1

2 release files

5.0.0

2 release files

4.4.3

2 release files

0.11.0

2 release files

0.10.8

2 release files

0.10.7

2 release files

0.10.6

2 release files

0.10.5

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.0

2 release files

0.8.9

2 release files

0.8.8

2 release files

0.8.7

2 release files

0.8.6

2 release files

0.8.5

2 release files

0.8.4

2 release files

0.8.3

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.9

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.9

2 release files

0.4.8

2 release files

0.4.7

2 release files

0.4.6

2 release files

0.4.5

2 release files

0.4.4

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page