HFortix - Python SDK for Fortinet Products#

PyPI version Python 3.10+ License Typing: Typed

HFortix is a modern, fully-typed Python SDK ecosystem for Fortinet products.

🔥 FortiOS/FortiGate

Complete FortiOS API client with 1,348 endpoints (561 CMDB + 490 Monitor + 286 Log + 11 Service). Available Now - v0.5.151 Beta

FortiOS
⚙️ Core Framework

Foundation HTTP client and exception handling. Available Now - v0.5.151 Beta

Core Package

Key Features#

Complete API Coverage

100% coverage of FortiOS 7.6.5 API (1,348 endpoints: 561 CMDB + 490 Monitor + 286 Log + 11 Service)

🎯 Fully Typed

Complete type hints with .pyi stubs for excellent IDE support. 100% type coverage for CMDB endpoints; partial coverage for Monitor/Log endpoints.

Modern & Fast

Async/await support with httpx, HTTP/2, connection pooling, and circuit breakers

🛡️ Production Ready

Comprehensive error handling, validation, retry logic, rate limiting, and 2,566+ test functions across 318 test files

🔄 Flexible Interface

Simple list format auto-converts to FortiOS dict format - use ["internal"] instead of [{"name": "internal"}]

Enhanced Developer Experience
  • FortiObject responses with attribute access (addr.subnet instead of addr['subnet'])

  • Multiple response formats (.dict, .json, .raw)

  • Built-in validation and error handling

  • FortiManager proxy support for managing multiple devices

Quick Example - FortiOS#

from hfortix_fortios import FortiOS

# Connect with context manager (automatic cleanup)
with FortiOS(host="192.168.1.99", token="your-api-token") as fgt:
    # Create firewall address
    fgt.api.cmdb.firewall.address.post(
        name="web-server",
        subnet="10.0.1.100/32",
        comment="Production web server"
    )

    # Create firewall policy - simple list format (auto-converted)
    fgt.api.cmdb.firewall.policy.post(
        name="Allow-Web-Traffic",
        srcintf=["internal"],      # Converted to [{"name": "internal"}]
        dstintf=["wan1"],          # Converted to [{"name": "wan1"}]
        srcaddr=["all"],           # Converted to [{"name": "all"}]
        dstaddr=["web-server"],    # Converted to [{"name": "web-server"}]
        service=["HTTP", "HTTPS"], # Converted to [{"name": "..."}]
        action="accept",
        nat="enable"
    )

See Quick Start Guide for more examples.

Installation#

# Install all available packages
pip install hfortix

# Or install specific packages
pip install hfortix-fortios  # FortiOS/FortiGate
pip install hfortix-core     # Core framework only

See Installation for detailed instructions.

Documentation#

Coverage Status#

FortiOS 7.6.5 API Coverage (February 2026)

561 endpoints

CMDB API

100% coverage - Configuration database management (100% type coverage)

🔷 v0.5.151 Beta

490 endpoints

Monitor API

100% coverage - Real-time monitoring and statistics (partial type coverage)

🔷 v0.5.151 Beta

286 endpoints

Log API

100% coverage - Log retrieval with full parameterization (partial type coverage)

🔷 v0.5.151 Beta

11 endpoints

Service API

100% coverage - Service operations (100% type coverage)

🔷 v0.5.151 Beta

Overall: 1,348 API methods across all categories (100% coverage) 🎉

  • 561 CMDB endpoints - Configuration database management (100% typed)

  • 490 Monitor endpoints - Real-time monitoring and statistics (partial types)

  • 286 Log endpoints - Log retrieval and analysis (partial types)

  • 11 Service endpoints - Service operations (100% typed)

  • 100% auto-generated - Complete schema coverage with intelligent generation

Package Status#

Package

Version

Status

Description

hfortix (meta)

0.5.151

Beta

Meta package - installs all available packages

hfortix-core

0.5.151

Beta

HTTP client, error handling, circuit breaker, observability

hfortix-fortios

0.5.151

Beta

FortiOS/FortiGate SDK - 1,348 endpoints (561 CMDB + 490 Monitor + 286 Log + 11 Service)

Community & Support#

License#

Proprietary license. See the License page for details.

Indices and Tables#