<?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 HOW TO REMOVE POLICY in Automation/API Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-remove-policy/m-p/334541#M2384</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm writing a script that removes policies that have hit counts equal to 0. How can I delethe them? what is the method to use. In the documentation I have not found the method to access the hit count variable, does it exist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandevice
import pandevice.firewall
import pandevice.policies
HOSTNAME = 'ip'
API_KEY = 'key'
fw = pandevice.firewall.Firewall(hostname=HOSTNAME, api_key=API_KEY)
rulebase = pandevice.policies.Rulebase()
fw.add(rulebase)
rules = pandevice.policies.SecurityRule.refreshall(rulebase)
for rule in rules:
    if(rule.hit_count == 0 ) ??
    fw.remove(rule) ??
    rule.apply()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jun 2020 13:04:30 GMT</pubDate>
    <dc:creator>EdoardoCerafogli</dc:creator>
    <dc:date>2020-06-22T13:04:30Z</dc:date>
    <item>
      <title>HOW TO REMOVE POLICY</title>
      <link>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-remove-policy/m-p/334541#M2384</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm writing a script that removes policies that have hit counts equal to 0. How can I delethe them? what is the method to use. In the documentation I have not found the method to access the hit count variable, does it exist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandevice
import pandevice.firewall
import pandevice.policies
HOSTNAME = 'ip'
API_KEY = 'key'
fw = pandevice.firewall.Firewall(hostname=HOSTNAME, api_key=API_KEY)
rulebase = pandevice.policies.Rulebase()
fw.add(rulebase)
rules = pandevice.policies.SecurityRule.refreshall(rulebase)
for rule in rules:
    if(rule.hit_count == 0 ) ??
    fw.remove(rule) ??
    rule.apply()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THANKS&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 13:04:30 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/automation-api-discussions/how-to-remove-policy/m-p/334541#M2384</guid>
      <dc:creator>EdoardoCerafogli</dc:creator>
      <dc:date>2020-06-22T13:04:30Z</dc:date>
    </item>
  </channel>
</rss>

