Table of Contents
git clone https://github.com/dmoruzzi/py-cloudflare-ddns.git
py-cloudflare-ddns
is a command line tool. It has the following operations:
usage: py-cloudflare-ddns.py [-h] --zoneid ZONEID --recordid RECORDID --apikey APIKEY --email EMAIL --recordname
RECORDNAME [--recordtype RECORDTYPE] [--insecure INSECURE] [--verbose VERBOSE]
[--protocol PROTOCOL]
options:
-h, --help show this help message and exit
--zoneid ZONEID CloudFlare Zone ID; https://developers.cloudflare.com/fundamentals/get-started/basic-
tasks/find-account-and-zone-ids/
--recordid RECORDID Cloudflare Record ID; https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
--apikey APIKEY Cloudflare API Key; https://dash.cloudflare.com/profile/api-tokens
--email EMAIL Email
--recordname RECORDNAME
Record Name
--recordtype RECORDTYPE
DNS record type (default: "A")
--insecure INSECURE allow insecure Global API Key access
--verbose VERBOSE Verbose output (default: False)
--protocol PROTOCOL DNS record protocol (default: "ipv4")
This CLI application is best maintained through a cron job. For example, to run this script every 24 hours, add the following line to your crontab:
0 0 * * * /path/to/py-cloudflare-ddns.py --zoneid <zoneid> --recordid <recordid> --apikey <apikey> --email <cloudflare_email> --recordname <recordname>
This script is currently limited to updating a single DNS record. If you would like to update multiple records, you can run this script multiple times with different arguments. You can also run this script multiple times with the same arguments, but this is not recommended :P
The CloudFlare API team is incredible for providing detailed and granular access to their REST API. This script is a wrapper for all the hardwork Cloudflare dedicated to the Internet. Thank you!