<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error in simple policy creation script in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/error-in-simple-policy-creation-script/m-p/391307#M2579</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;You need to create a rulebase object before you can add to it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Create a new rule
rulebase = fw.add(Rulebase())

new_rule = rulebase.add(panos.policies.SecurityRule("Madinah-Rule", description="Madinah"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Seb.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Mar 2021 16:44:06 GMT</pubDate>
    <dc:creator>SebRupik</dc:creator>
    <dc:date>2021-03-15T16:44:06Z</dc:date>
    <item>
      <title>Error in simple policy creation script</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/error-in-simple-policy-creation-script/m-p/391086#M2576</link>
      <description>&lt;P&gt;Hello all;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following script:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#!/usr/bin/python3

import panos
from panos import base
from panos import firewall
from panos import panorama
from panos import policies
from panos import objects
from panos import network
from panos import device
from panos.policies import Rulebase, SecurityRule

fw = firewall.Firewall("192.168.122.5", "admin", "admin")
webserver = objects.AddressObject("Apache-webserver", "5.5.5.5", description="Company web server")
fw.add(webserver)
webserver.create()
fw.commit()

#Create a new rule
new_rule = panos.policies.SecurityRule("Madinah-Rule", description="Madinah")
#rule = Rulebase.add(SecurityRule("Madinah-Rule"))
Rulebase.add(new_rule)
new_rule.create()
fw.commit(Sync=True)&lt;/LI-CODE&gt;&lt;P&gt;But when I run it using the command python3 script.py I am getting the error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Traceback (most recent call last):
  File "madinah-pan-os-script.py", line 22, in &amp;lt;module&amp;gt;
    Rulebase.add(new_rule)
TypeError: add() missing 1 required positional argument: 'child'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please point me in the right direction. I guess it has something to do with difference in Python2 and Python3.&lt;/P&gt;</description>
      <pubDate>Sat, 13 Mar 2021 22:01:26 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/error-in-simple-policy-creation-script/m-p/391086#M2576</guid>
      <dc:creator>ausafali88</dc:creator>
      <dc:date>2021-03-13T22:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error in simple policy creation script</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/error-in-simple-policy-creation-script/m-p/391307#M2579</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;You need to create a rulebase object before you can add to it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;#Create a new rule
rulebase = fw.add(Rulebase())

new_rule = rulebase.add(panos.policies.SecurityRule("Madinah-Rule", description="Madinah"))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Seb.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Mar 2021 16:44:06 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/error-in-simple-policy-creation-script/m-p/391307#M2579</guid>
      <dc:creator>SebRupik</dc:creator>
      <dc:date>2021-03-15T16:44:06Z</dc:date>
    </item>
  </channel>
</rss>

