Package: cloudflare-dns
cloudflare-dnsCLI and Python tool for managing Cloudflare DNShttps://github.com/ZigZagT/cloudflare-dnsInstallationpipinstallcloudflare-dnsUsageusage: cloudflare-dns [-h] [--ignore-api-error] [-z ZONE] [-e EMAIL] [-k KEY] [-t TOKEN] (-lz | -lr | -sr | -dr) [--filter-content REGEX] [--proxied] [{A,AAAA,CNAME,TXT,ANY}] [domain] [content] [ttl]

options:
  -h, --help            show this help message and exit
  --ignore-api-error    treat 5xx API responses as success
  -lz, --list-zone      [action] list zones, record frags and filters are ignored for this action
  -lr, --list-record    [action] list DNS records in a zone, record frags are used as filters when provided
  -sr, --set-record     [action] create or update DNS record to match record frags, removes any existing records that matches the [type, domain] tuple; use the filters to limit the removing to matching records only
  -dr, --delete-record  [action] delete DNS record base on provided record frags and filters

authentication arguments:
  -z ZONE, --zone ZONE  specify the zone by its domain name, usually can be inferred from the domain parameter
  -e EMAIL, --email EMAIL
                        default to environment variable CF_API_EMAIL
  -k KEY, --key KEY     default to environment variable CF_API_KEY
  -t TOKEN, --token TOKEN
                        default to environment variable CF_API_TOKEN. Note the use of api token is exclusive, --email and --key must not be used when --token is used.

filtering arguments:
  scope operations of changing / removing records by the filters

  --filter-content REGEX
                        filter records by matching their content against the provided regex.

record frags:
  use record frags to describes a single DNS record, may freely provide from 0 to all 5 frags, as long as it makes sense to the chosen action

  {A,AAAA,CNAME,TXT,ANY}
                        record type, ANY is only valid for filtering
  domain                full qualified domain name
  content               the content of the record
  ttl                   ttl value of 1 means auto on Cloudflare; ignored for -lr and -dr
  --proxied             set cloudflare proxy on/off state; ignored for -lr and -drExamples of typical UsagesDynamic DNS (DDNS)IP=$(curl-sLhttps://ipinfo.io/ip)cloudflare-dns-srAdev.example.com$IPcloudflare-dns-srAwww.example.com$IP--proxied
cloudflare-dns-srAlong-dns-ttl.example.com$IP36000--proxiedShow all TXT records at root domaincloudflare-dns-lrTXTexample.com# records:# -------------------------------------------------------------------------------#     id: aaaa#     type: TXT#     name: example.com#     content: google-site-verification=aaaa#     ttl: 1#     proxiable: False#     proxied: False#     locked: False# -------------------------------------------------------------------------------#     id: bbbb#     type: TXT#     name: example.com#     content: v=spf1 include:_spf.google.com ~all#     ttl: 1#     proxiable: False#     proxied: False#     locked: False# -------------------------------------------------------------------------------Show SPF TXT record at root domaincloudflare-dns-lrTXTexample.com--filter-contentv=spf1# records:# -------------------------------------------------------------------------------#     id: bbbb#     type: TXT#     name: example.com#     content: v=spf1 include:_spf.google.com ~all#     ttl: 1#     proxiable: False#     proxied: False#     locked: False# -------------------------------------------------------------------------------Update a SPF TXT records at root domaincloudflare-dns-srTXTexample.com'v=spf1 include:_spf.google.com ~all'--filter-contentv=spf1# UNCHANGED: example.com v=spf1 include:_spf.google.com ~allBatch update DMARC records for multiple sitesfordomainin$(catmy_domains.txt);docloudflare-dns-sr--filter-contentv=DMARC1\TXT\_dmarc.$domain\"v=DMARC1; p=quarantine; fo=0:1:d:s; rua=mailto:dmarc@$domain; ruf=mailto:dmarc@$domain; aspf=r; adkim=s;"\3600doneHow to authenticate with the Cloudflare API:# option 1: by using environment variablesexportCF_API_EMAIL="<my cloudflare email>"exportCF_API_KEY="<my cloudflare api key>"cloudflare-dns-srAdev.example.com$IP# option 2: via command line parameterscloudflare-dns-e$MY_EMAIL-k$MY_KEY-srAdev.example.com$IP