pan-os-python icon indicating copy to clipboard operation
pan-os-python copied to clipboard

Fetching objects from Pre-defined location via SDK

Open saipratap99 opened this issue 11 months ago • 1 comments

I’m trying to retrieve Application objects from a predefined location.

The REST endpoint accepts a location query parameter, which can be set to shared, predefined, or device-group.

I’d like to fetch objects from the predefined location using the SDK, but I don't see any option to specify the location. By default, it only retrieves objects from the shared location.

import panos

fw = panos.firewall.Firewall(HOSTNAME, USERNAME, PASSWORD)
existing_objects = panos.objects.AddressObject.refreshall(fw, add=False)
# fetched objects from shared location.

saipratap99 avatar Dec 10 '25 11:12 saipratap99

Just grab them via the show predefined command:

all_apps = fw.op("<show><predefined><xpath>/predefined/application</xpath></predefined></show>", cmd_xml=False)
app_entries = all_apps.findall('.//application/entry')

ngfw-automation avatar Dec 11 '25 11:12 ngfw-automation

Thank you @ngfw-automation , this is cool. but I found a way where we can fetch predefined application objects via SDK too.

pre_defined_objects = panorama.predefined.application_objects.values()

saipratap99 avatar Dec 16 '25 15:12 saipratap99

@saipratap99 yes, good find - indeed, you can pull the ApplicationObject instances from there. However, this will be somewhat incomplete in fact. If you use the op command I suggested you'll also be able to find some cool stuff, such as Base64-encoded applications icons, for example.

ngfw-automation avatar Dec 17 '25 00:12 ngfw-automation

Thank you @ngfw-automation , I would try op command and see what I can get out of it for predefined app objects. 😃

saipratap99 avatar Dec 18 '25 20:12 saipratap99