Registry / devops / pan-os-python

pan-os-python

JSON →
library1.13.0pypypiunverified

Palo Alto Networks SDK for Python to interact with PanOS devices via XML API. Version 1.12.5, active development with regular bugfix releases. Supports Python >=2.7 but not 3.0-3.4.

pip install pan-os-python
INSTALL
IMPORT
SIG · PAN-OS-PYTHON
P
pan-os-python
devopspythonv1.13.0
Install
1.7s avg
Import
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.13.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.7s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

PanDevice
from panos import PanDevice
from panos import PanDevice

Connect to a Palo Alto Networks firewall and list security rules.

import os from panos.firewall import Firewall from panos.policies import Rulebase, SecurityRule # Connect to firewall using environment variables fw = Firewall(os.environ.get('PANOS_HOST', ''), os.environ.get('PANOS_USER', 'admin'), os.environ.get('PANOS_PASS', 'admin')) # Retrieve running config fw.refresh_system_info() print(f"Connected to {fw.hostname} running PanOS {fw.version}") # List security rules rulebase = Rulebase() fw.add(rulebase) rules = SecurityRule.refreshall(rulebase) for rule in rules: print(rule.name, rule.to, rule.from_)
Debug
Known issues
breakingIn v1.9+, the 'from' attribute of SecurityRule is reserved, use 'from_' in Python code.
fix
Use 'from_' (with underscore) as the attribute name in Python, e.g., rule.from_
affects: >=1.9.0
breakingThe PanDevice class no longer auto-detects whether device is a firewall or panorama in v1.12+. Use explicit Firewall or Panorama constructors.
fix
Replace PanDevice(hostname, api_username, api_password) with Firewall(hostname, api_username, api_password) or Panorama(...).
affects: >=1.12.0
gotchaMany objects like 'tag' are not refreshed automatically after creation. You must call refresh() or create() before accessing sub-elements.
fix
After adding an object to a device, call .create() on it or use .refreshall() to retrieve existing configurations.
affects: all
gotchaCommit operations are not synchronous by default. The commit() method returns a job ID; you need to poll for completion.
fix
Use fw.commit(sync=True) to block until the commit finishes, or handle job polling manually with commit() and waitfor()
affects: all
Upgrade
Version history
1.13.0latest on PyPI · released Jun 2, 2026
Audit
Dependencies
pan-pythonrequiredCore dependency for PanOS API interaction
xmltodictrequiredXML parsing of API responses
requestsrequiredUsed for HTTP(S) API calls
Agent activity
24 hits · last 30 days
node
22
OpenAI (training)
1
Resources
pan-os-python — pip install pan-os-python · libregistry