Package Details
HFortix provides three packages that can be installed individually or together, depending on your needs. Each package is published separately on PyPI and has its own documentation.
Package Selection Guide
Package |
Install When |
Documentation |
|---|---|---|
|
You want the complete suite with all components |
|
|
You need FortiGate/FortiOS automation only |
|
|
You’re building custom Fortinet integrations |
hfortix (Meta Package)
The meta-package that installs all HFortix components.
What It Includes:
hfortix-fortios- Complete FortiOS/FortiGate API clienthfortix-core- Foundation libraries and infrastructure
Installation:
pip install hfortix
Package Info:
Repository: https://github.com/hermanwjacobsen/hfortix
Documentation: https://hfortix.readthedocs.io/
When to Use:
Starting a new FortiGate automation project
You want all available components
Simplest installation - one command gets everything
hfortix-fortios
Complete FortiOS/FortiGate API client with full type safety and comprehensive endpoint coverage.
Features:
1,348 FortiOS 7.6.5 Endpoints - Complete coverage of CMDB, Monitor, Log, and Service APIs
Full Type Safety - Pydantic models and TypedDict definitions for all operations
Async/Await Support - Both synchronous and asynchronous clients included
Batch Transactions - Atomic configuration changes with automatic rollback
Rate Limiting - Built-in rate limiting and retry logic for production use
Request Hooks - Intercept and modify requests/responses for custom workflows
Audit Logging - Enterprise-grade audit logging for compliance (SOC 2, HIPAA, PCI-DSS)
Installation:
pip install hfortix-fortios
Package Info:
Repository: https://github.com/hermanwjacobsen/hfortix-fortios
Documentation: https://hfortix-fortios.readthedocs.io/
Dependencies:
hfortix-core>=0.5.0- Foundation librarieshttpx>=0.27.0- Modern HTTP clientpydantic>=2.0.0- Data validation and type safety
When to Use:
You need FortiOS/FortiGate automation
You want complete API coverage with type safety
Production deployments requiring enterprise features
Example:
from hfortix_fortios import FortiOS
with FortiOS(host="192.168.1.99", token="your-token") as fgt:
# Create firewall address
fgt.api.cmdb.firewall.address.post(
name="web-server",
subnet="10.0.1.100/32"
)
# Get all policies
policies = fgt.api.cmdb.firewall.policy.get()
hfortix-core
Foundation libraries providing HTTP clients, audit logging, debugging, and shared utilities used across all HFortix packages.
Features:
HTTP Client Framework - FortiOS and FortiManager HTTP clients with retry logic and circuit breakers
Enterprise Audit Logging - Syslog, file, and stream handlers with JSON, CEF, and RFC 5424 formats
Request Hooks Protocol - Before/after request hooks for custom request/response handling
Exception Hierarchy - 20+ exception types for granular error handling
Structured Logging - JSON and text formatters for integration with enterprise logging systems
Debug Utilities - Debug sessions, timing decorators, connection stats, and request inspection
Type Safety - Comprehensive TypedDict definitions for all internal structures
Caching - TTL-based cache for readonly reference data
Installation:
pip install hfortix-core
Package Info:
Repository: https://github.com/hermanwjacobsen/hfortix-core
Documentation: https://hfortix-core.readthedocs.io/
Dependencies:
httpx[http2]>=0.27.0- HTTP client with HTTP/2 supporttyping_extensions>=4.0.0- Enhanced type hints
When to Use:
Building custom Fortinet API clients
You need infrastructure without the full FortiOS client
Developing extensions or integrations for HFortix
You want just the HTTP client and logging capabilities
Example:
from hfortix_core.http import HTTPClient
from hfortix_core.audit import SyslogHandler
# Create custom FortiOS client
client = HTTPClient(
url="https://192.168.1.99",
token="your-token",
verify=True,
max_retries=3
)
# Add audit logging
client.audit_handler = SyslogHandler("siem.company.com:514")
# Make API requests
response = client.get("cmdb", "/api/v2/cmdb/system/global")
Dependency Chain
Understanding the dependency relationships:
hfortix (meta-package)
├── hfortix-fortios
│ ├── hfortix-core
│ │ ├── httpx[http2]>=0.27.0
│ │ └── typing_extensions>=4.0.0
│ ├── httpx>=0.27.0
│ └── pydantic>=2.0.0
└── hfortix-core (same as above)
Key Points:
hfortix-corehas minimal dependencies and can be used standalonehfortix-fortiosrequireshfortix-corefor its HTTP client and utilitieshfortixinstalls all components for a complete automation platform
Version Compatibility
All HFortix packages use synchronized versioning. When installing, ensure version compatibility:
# Install specific version across all packages
pip install hfortix==0.5.156
# Or install compatible versions individually
pip install hfortix-core==0.5.156 hfortix-fortios==0.5.156
Compatibility Matrix:
Installing hfortix-fortios automatically installs hfortix-core.
Installing hfortix automatically installs both component packages.