New clean rules script

This script is an example of a purge to replace all existing rules with new ones.
 1import os
 2
 3import dotenv
 4
 5from cf_rules import Cloudflare
 6
 7dotenv.load_dotenv(".env")
 8
 9cf = Cloudflare("expressions")
10cf.auth_key(os.environ.get("EMAIL"), os.environ.get("KEY"))
11
12# TODO Have some rules in the expressions folder
13
14# First delete all existing rules
15cf.purge_rules("example.com")
16
17# Then import all the rules from your expressions folder
18cf.import_rules("example.com", "block")

Danger

This script is cleaning all the rules from a domain. It is used if you want to replicate the rules from a domain to another one.

Be careful when using cf.Cloudflare.purge_rules() method.