Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.

License

NotificationsYou must be signed in to change notification settings

PaloAltoNetworks/pan-os-python

The PAN-OS SDK for Python (pan-os-python) is a package to help interact withPalo Alto Networks devices (including physical and virtualized Next-generationFirewalls and Panorama). The pan-os-python SDK is object oriented and mimicsthe traditional interaction with the device via the GUI or CLI/API.


Latest version released on PyPiPython versionsLicenseDocumentation StatusChat on GitHub Discussions

semantic-releaseConventional CommitsPowered by DepHellGitHub contributors


Features

  • Object model of Firewall and Panorama configuration
  • Multiple connection methods including Panorama as a proxy
  • All operations natively vsys-aware
  • Support for high availability pairs and retry/recovery during node failure
  • Batch User-ID operations
  • Device API exception classification

Status

Palo Alto Networks PAN-OS SDK for Python is considered stable. It is fully testedand used in many production environments. Semantic versioning is applied to indicatebug fixes, new features, and breaking changes in each version.

Install

Install using pip:

pip install pan-os-python

Upgrade to the latest version:

pip install --upgrade pan-os-python

If you have poetry installed, you can also add pan-os-python to your project:

poetry add pan-os-python

How to import

To use pan-os-python in a project:

importpanos

You can also be more specific about which modules you want to import:

frompanosimportfirewallfrompanosimportnetwork

A few examples

For configuration tasks, create a tree structure using the classes ineach module. Nodes hierarchy must follow the model in theConfiguration Tree.

The following examples assume the modules were imported as such:

frompanosimportfirewallfrompanosimportnetwork

Create an interface and commit:

fw=firewall.Firewall("10.0.0.1",api_username="admin",api_password="admin")eth1=network.EthernetInterface("ethernet1/1",mode="layer3")fw.add(eth1)eth1.create()fw.commit()

Operational commands leverage the 'op' method of the device:

fw=firewall.Firewall("10.0.0.1",api_username="admin",api_password="admin")printfw.op("show system info")

Some operational commands have methods to refresh the variables in an object:

# populates the version, serial, and model variables from the live devicefw.refresh_system_info()

See more examples in theUsage Guide.

Upgrade from pandevice

Thispan-os-python package is the evolution of the olderpandevice package. Toupgrade frompandevice topan-os-python, follow these steps.

Step 1. Ensure you are using python3

Python2 is end-of-life and notsupported bypan-os-python.

Step 2. Uninstall pandevice:

pip uninstall pandevice# orpoetry remove pandevice

Step 3. Install pan-os-python:

pip3 install pan-os-python# orpoetry add pan-os-python

Step 4. Change the import statements in your code frompandevice topanos. For example:

importpandevicefrompandevice.firewallimportFirewall# would change toimportpanosfrompanos.firewallimportFirewall

Step 5. Test your script or application

There are no known breaking changesbetweenpandevice v0.14.0 andpan-os-python v1.0.0, but it is a majorupgrade so please verify everything works as expected.

Contributors

Thank you toKevin Steves, creator of thepan-python library

About

The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp