Python script to use Cloudflare for dynamic DNS
-
Create an A record in CloudFlare
-
Create an API token with write access to the zone the A record is in.
-
Run
update.py
to generate a config file and update the A record to your current public IP address:$ python update.py Auth token: Njk2ZD-I5ZTA5NDBhNDk1Nzc0OGZlM2ZjOWVmZDI Zone name: example.com A record name: updateme.example.com INFO:root:Saving new config to cloudflare-dynamic-dns.json INFO:root:Updated updateme.example.com (1.2.3.4)
-
Periodically re-run the script (e.g. via cron) to keep the A record up-to-date.