Skip to main content

HFortix

PyPI version Python 3.10+ Documentation Status License Typing: Typed

HFortix is the meta-package that installs all HFortix components for Fortinet automation. Install this package to get the complete suite of tools for FortiOS/FortiGate automation.

🚀 Quick Start

pip install hfortix

This single command installs:

  • hfortix-core - Core infrastructure and utilities
  • hfortix-fortios - FortiOS/FortiGate API client
from hfortix_fortios import FortiOS

# Connect to your FortiGate
with FortiOS(host="192.168.1.99", token="your-api-token") as fgt:
    # Get system status
    status = fgt.api.monitor.system.status.get()
    print(f"Hostname: {status['hostname']}, Model: {status['model']}")
    
    # Create firewall address
    fgt.api.cmdb.firewall.address.post(
        name="web-server",
        subnet="10.0.1.100/32",
        comment="Production web server"
    )

📦 What's Included

When you install hfortix, you automatically get:

hfortix-fortios

Complete FortiOS/FortiGate API client with:

  • 1,348 FortiOS 7.6.5 endpoints
  • Full type hints and IDE autocomplete
  • Async/await support
  • Batch transactions and atomic operations
  • Comprehensive error handling
  • Rate limiting and retry logic

hfortix-core

Foundational infrastructure including:

  • Shared HTTP client framework (retry logic, circuit breaker, rate limiting)
  • Exception hierarchy and error-code mapping
  • Audit logging and debugging utilities
  • Base abstractions and shared utilities

Optional extras

pip install "hfortix[forticare]"   # + hfortix-forticare (FortiCare asset management)
pip install "hfortix[fortiztp]"    # + hfortix-fortiztp (FortiZTP provisioning)
pip install "hfortix[all]"         # everything above

✨ Key Features

  • 🎯 Complete API Coverage - All CMDB, Monitor, Log, and Service endpoints
  • 💪 Fully Typed - Complete type hints with .pyi stubs
  • ⚡ Modern & Fast - Async/await support, HTTP/2, connection pooling
  • 🛡️ Production Ready - Comprehensive error handling and validation
  • 🔄 Simplified Syntax - Simple list format auto-converts to FortiOS dict format
  • 📦 Batch Transactions - Atomic configuration changes with automatic commit/rollback
  • 🔍 API Inspection - Debug and audit API interactions

📚 Documentation

🔗 Individual Packages

If you only need specific components, you can install them separately:

# Just the FortiOS client (includes hfortix-core as dependency)
pip install hfortix-fortios

# Just the core infrastructure (for custom implementations)
pip install hfortix-core

🆚 Package Comparison

Package Purpose Dependencies Use When
hfortix Meta-package core + fortios (+ optional extras) You want the suite
hfortix-fortios FortiOS API client hfortix-core FortiGate automation
hfortix-core Core infrastructure httpx, typing-extensions Building custom clients

📖 Quick Examples

Firewall Management

from hfortix_fortios import FortiOS

with FortiOS(host="192.168.1.99", token="token") as fgt:
    # Create firewall policy
    fgt.api.cmdb.firewall.policy.post(
        name="Allow-Web",
        srcintf=["internal"],
        dstintf=["wan1"],
        srcaddr=["all"],
        dstaddr=["web-server"],
        service=["HTTP", "HTTPS"],
        action="accept"
    )

Batch Transactions

from hfortix_fortios import FortiOS

with FortiOS(host="192.168.1.99", token="token") as fgt:
    # Atomic batch operation - API calls made inside the block
    # automatically join the transaction
    with fgt.transaction() as txn:
        fgt.api.cmdb.firewall.address.post(name="server1", subnet="10.0.1.1/32")
        fgt.api.cmdb.firewall.address.post(name="server2", subnet="10.0.1.2/32")
        # Auto-commits on success; auto-aborts (rolls back) on error

Async Support

from hfortix_fortios import FortiOS

fgt = FortiOS(host="192.168.1.99", token="token", mode="async")
status = await fgt.api.monitor.system.status.get()
addresses = await fgt.api.cmdb.firewall.address.get()

🤝 Contributing

This is a proprietary library. For support or feature requests, please contact the maintainer.

📄 License

Proprietary License - See individual package LICENSE files for details.


HFortix - Modern Python SDKs for Fortinet automation

Metadata

Release files for hfortix 0.5.164

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

Source distribution (sdist)

Source distribution for hfortix 0.5.164
File Size Uploaded
hfortix-0.5.164.tar.gz 12.2 kB Details

Built distribution (wheel)

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

Total release size: 19.1 kB

Release files / hfortix-0.5.164.tar.gz

Download URL hfortix-0.5.164.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d0f83ffaaf66f482f7abd79b503b72ac513a25d8f7203d4fc68fc06139b7d85c
BLAKE2b-256 checksum
How to use checksums
125c021dc95d13e1ee9a32206b5fb3b7ecc5858bdbf231e3ead636fbde8f6621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / hfortix-0.5.164-py3-none-any.whl

Download URL hfortix-0.5.164-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a703521b0bba40ab61bfdbaf2dcd81de331c5c4184377439fa275eda7a34bd4d
BLAKE2b-256 checksum
How to use checksums
9ed52862c71109fe0850ce9d09ad200b4bb41d4a781f2ac40913919873438601
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.5.164 This release

2 release files

0.5.143

1 release file

0.5.99

2 release files

0.5.98

2 release files

0.5.97

2 release files

0.5.96

2 release files

0.5.95

2 release files

0.5.94

2 release files

0.5.93

2 release files

0.5.92

2 release files

0.5.91

2 release files

0.5.90

2 release files

0.5.89

2 release files

0.5.88

2 release files

0.5.87

2 release files

0.5.86

2 release files

0.5.85

2 release files

0.5.84

2 release files

0.5.79

2 release files

0.5.78

2 release files

0.5.77

2 release files

0.5.76

2 release files

0.5.75

2 release files

0.5.74

2 release files

0.5.73

2 release files

0.5.72

2 release files

0.5.71

2 release files

0.5.70

2 release files

0.5.63

2 release files

0.5.62

2 release files

0.5.61

2 release files

0.5.60

2 release files

0.5.59

2 release files

0.5.57

2 release files

0.5.56

2 release files

0.5.55

2 release files

0.5.54

2 release files

0.5.53

2 release files

0.5.52

2 release files

0.5.51

2 release files

0.5.50

2 release files

0.5.49

2 release files

0.5.48

2 release files

0.5.35

1 release file

0.5.9

2 release files

0.5.7

2 release files

0.5.6

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

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.39

2 release files

0.3.38

2 release files

0.3.37

2 release files

0.3.36

2 release files

0.3.35

2 release files

0.3.34

2 release files

0.3.33

2 release files

0.3.32

2 release files

0.3.31

2 release files

0.3.28

2 release files

0.3.27

2 release files

0.3.26

2 release files

0.3.25

2 release files

0.3.24

2 release files

0.3.23

2 release files

0.3.22

2 release files

0.3.21

2 release files

0.3.20

2 release files

0.3.19

2 release files

0.3.18

2 release files

0.3.17

2 release files

0.3.16

2 release files

0.3.15

2 release files

0.3.14

2 release files

0.3.13

2 release files

0.3.12

2 release files

0.3.11

2 release files

0.3.10

2 release files

0.3.9

2 release files

0.3.8

2 release files

0.3.7

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.0

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