HFortix-FortiManager
HFortix-FortiManager is a modern, fully-typed Python SDK for the FortiManager
JSON-RPC API — 2,376 endpoints generated from the official FMG 7.6.6 API
specification, with full .pyi type stubs for IDE autocomplete on every call.
🚀 Quick Start
pip install hfortix-fortimanager
from hfortix_fortimanager import FortiManager
# API key auth (FMG 7.4.7+ / 7.6.2+) — no login/logout needed
fmg = FortiManager(host="fmg.example.com", api_key="your-api-key")
# Session auth — context manager handles login/logout
with FortiManager(host="fmg.example.com", username="admin", password="pw") as fmg:
# Device inventory
devices = fmg.api.dvmdb.adom.device.get(adom="root")
for dev in devices:
print(dev.name, dev.ip, dev.os_ver)
# Firewall address objects (ADOM-scoped)
fmg.api.pm.config.adom.obj.firewall.address.add(
adom="root",
name="web-server",
subnet=["10.0.1.100", "255.255.255.255"],
)
# Firewall policy in a policy package — with placement control
fmg.api.pm.config.adom.pkg.firewall.policy.add(
adom="root",
pkg="default",
name="Allow-Web",
srcintf=["port1"], dstintf=["port2"],
srcaddr=["all"], dstaddr=["web-server"],
service=["HTTPS"], action="accept", schedule=["always"],
before="42", # insert before policyid 42 (omit to append)
)
✨ Key Features
- 🎯 2,376 endpoints — Device DB (
dvmdb), Policy & Objects (pm: ADOM objects, device-level config, policy packages, policy blocks, system/WAN templates), andtaskmonitoring - 💪 Fully typed —
.pyistubs for every endpoint;Literal[...]enums for every documented value; PEP 561py.typed - 🔑 Dual auth — session (username/password with automatic re-login) or
API key (Bearer, FMG 7.4.7+/7.6.2+, incl.
api_userfor 7.6.6+) - 🧭 Navigation mirrors the API — URL scoping segments are kept:
/pm/config/adom/{adom}/obj/firewall/address→fmg.api.pm.config.adom.obj.firewall.address - 📦 Minimal payloads — only the parameters you pass are sent; FMG applies its own server-side defaults (no surprise field writes)
- 🛡️ Production plumbing from hfortix-core — retry with backoff, optional rate limiting and circuit breaker, audit logging, sanitized logs
- 🔒 Workspace mode —
dvmdb.adom.workspacelock / commit / unlock endpoints for ADOMs in workspace mode
🧰 GET options
All JSON-RPC read options are typed parameters:
fmg.api.dvmdb.adom.device.get(
adom="root",
fields=["name", "ip", "os_ver"],
filter=["conf_status", "==", "insync"],
range=[0, 50],
loadsub=0,
)
🪄 Escape hatch — raw JSON-RPC
Anything not (yet) exposed as a typed endpoint can be called directly:
result = fmg.client.execute(
method="exec",
params=[{"url": "/securityconsole/install/package",
"data": {"adom": "root", "pkg": "default"}}],
)
⚠️ Known limitations (0.1.x)
- No
securityconsole/ install-deploy endpoints yet — configuration management is fully covered, but installing policy packages to devices currently requires the rawfmg.client.execute()escape hatch (see above). Planned for an upcoming release. model_registry/as_models()/ typed response models are experimental placeholders — they currently returnNone/ fall back to generic objects.- Sync only — no async client yet (unlike hfortix-fortios).
🔗 Related Packages
This package is part of the HFortix SDK ecosystem:
- hfortix-core — Core HTTP client and utilities
- hfortix-fortios — FortiOS/FortiGate SDK
- hfortix — Meta package
📄 License
Proprietary license. All rights reserved.
🤝 Support
- Issues: https://github.com/hermanwjacobsen/hfortix-fortimanager/issues
- PyPI: https://pypi.org/project/hfortix-fortimanager/
Version: 0.1.0 (Alpha)
FortiManager Support: 7.6.6 (specs; 7.4.x compatible)
Python: 3.10+
Metadata
Release files for hfortix-fortimanager 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hfortix_fortimanager-0.1.1.tar.gz | 5.5 MB | Without provenance | Details for hfortix_fortimanager-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hfortix_fortimanager-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for hfortix_fortimanager-0.1.1-py3-none-any.whl |
Total release size: 18.1 MB
Release files / hfortix_fortimanager-0.1.1.tar.gz
| Download URL | hfortix_fortimanager-0.1.1.tar.gz |
|---|---|
| Size | 5.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dd99d8a49f7df35949432c61231fc84a9f6ac87d63b02725bb0c969b7df4ffc2
|
|
BLAKE2b-256 checksum How to use checksums |
42e96ca0fcde912bceb21968955cda77810650405c87edf7d3983608feb4cc70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / hfortix_fortimanager-0.1.1-py3-none-any.whl
| Download URL | hfortix_fortimanager-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71ba68134be582eee7985f611c1b8ef42689948a4d5a5c169897f83a55000c67
|
|
BLAKE2b-256 checksum How to use checksums |
d7faee215ebf326de274ffe80b929fdaaa8bf554df507c5a661eaefa36e38dc0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for hfortix-fortimanager 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.