- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
Enhanced Security Measures in Place: To ensure a safer experience, we’ve implemented additional, temporary security measures for all users.
12-29-2019 11:32 PM
Getting below error when connecting to firewall:
>>> import pandevice
>>> fw = Firewall("137.117.105.197", “firewall”, “firewall@123”)
File "<stdin>", line 1
fw = Firewall("137.117.105.197", “firewall”, “firewall@123”)
^
SyntaxError: invalid character in identifier
>>> print fw.op("show system info")
File "<stdin>", line 1
print fw.op("show system info")
^
SyntaxError: invalid syntax
01-02-2020 09:13 AM
This is a python syntax problem, you just need to fix your imports. You need to do either this:
import pandevice
fw = pandevice.firewall.Firewall("137.117.105.197", “firewall”, “firewall@123”)
or this (recommended):
from pandevice.firewall import Firewall
fw = Firewall("137.117.105.197", “firewall”, “firewall@123”)
12-30-2019 10:31 PM
I have never used pandevice module. But as an alternative, you get the system info by using either one of the below options.
1. By using PA API, requests module (to make API call) & xml.etree.ElementTree module (to parse the xml output of API call).
or
2. By using netmiko library. It allow to do SSH to multiple networking vendor devices. You can find more info here.
01-02-2020 09:13 AM
This is a python syntax problem, you just need to fix your imports. You need to do either this:
import pandevice
fw = pandevice.firewall.Firewall("137.117.105.197", “firewall”, “firewall@123”)
or this (recommended):
from pandevice.firewall import Firewall
fw = Firewall("137.117.105.197", “firewall”, “firewall@123”)
01-02-2020 10:30 AM - edited 01-02-2020 10:41 AM
Thanks.I got that figured out.I had another question, I am running below script
import pandevice
from pandevice import base
from pandevice import firewall
from pandevice import panorama
from pandevice import policies
from pandevice import objects
from pandevice import network
from pandevice import device
fw = firewall.Firewall("40.71.172.9", api_username= "Pa-pan", api_password= "firewall@123")
baseAddressA = "10.1.1."
for x in range(10):
AddressA = baseAddressA + str(x)
AddressAName = "AddressA-" + str(x)
fw.add(objects.AddressObject(AddressAName,AddressA)).create()
I am expecting objects between 1-9 to be created but I only see one object getting created i.e AddressA-9=10.1.1.9
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!