{"id":23181747,"url":"https://github.com/itachi1621/cloudflare-dns-updater","last_synced_at":"2025-08-10T03:38:53.417Z","repository":{"id":212410126,"uuid":"722346756","full_name":"itachi1621/cloudflare-dns-updater","owner":"itachi1621","description":" Python script that updates Cloudflare DNS records based on changes in the public IP address of your network. ","archived":false,"fork":false,"pushed_at":"2023-12-14T04:24:09.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T03:38:53.081Z","etag":null,"topics":["api","cloudflare","cron","ddns","dns","ipv4","ipv4-address","python","python-3","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itachi1621.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-23T00:23:39.000Z","updated_at":"2023-12-14T22:05:46.000Z","dependencies_parsed_at":"2023-12-14T05:28:32.977Z","dependency_job_id":"ff346e50-098f-4a92-8d78-cc65c5fb95ae","html_url":"https://github.com/itachi1621/cloudflare-dns-updater","commit_stats":null,"previous_names":["itachi1621/cloudflare-dns-updater"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itachi1621/cloudflare-dns-updater","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itachi1621%2Fcloudflare-dns-updater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itachi1621%2Fcloudflare-dns-updater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itachi1621%2Fcloudflare-dns-updater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itachi1621%2Fcloudflare-dns-updater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itachi1621","download_url":"https://codeload.github.com/itachi1621/cloudflare-dns-updater/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itachi1621%2Fcloudflare-dns-updater/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269672480,"owners_count":24457115,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-10T02:00:08.965Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cloudflare","cron","ddns","dns","ipv4","ipv4-address","python","python-3","python3"],"created_at":"2024-12-18T08:17:52.835Z","updated_at":"2025-08-10T03:38:53.394Z","avatar_url":"https://github.com/itachi1621.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cloudflare DNS Updater\n\n![Cloudflare Logo](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4b/Cloudflare_Logo.svg/512px-Cloudflare_Logo.svg.png)\n\n## Overview\n\nThis Python script updates Cloudflare DNS records based on changes in the public IP address of your network. It is designed to be used in either **service or cron mode**. The script retrieves the current public IP address, compares it with the last known IP address stored in a file, and updates Cloudflare DNS records if there is a change.\n\n## Prerequisites\n\n- Python 3.x\n- `requests` library (install using `pip install requests`)\n\t- Alternatively use `pip install -r requirements.txt` to install all packages needed\n\n## Configuration\n\nBefore running the script, you need to configure it by providing the necessary information in the `config.json` file a sample file called `sample_config.json` is provided\n\n### `config.json`\n\n```json\n{\n  \"Application-Config\": {\n    \"MODE\": \"Cron\",  # Options: \"Service\" or \"Cron\"\n    \"SERVICE-INTERVAL\": 300  # Interval in seconds for checking IP changes (applicable in service mode)\n  },\n  \"Cloudflare-Config\": [\n    {\n      \"API_TOKEN\": \"YOUR_CLOUDFLARE_API_TOKEN\",\n      \"ZONE_ID\": \"YOUR_CLOUDFLARE_ZONE_ID\",\n      \"SITE\": \"example.com\",  # Your domain\n      \"RECORD_TYPE\": \"A\",  # DNS record type (A, AAAA, CNAME, TXT, SRV, LOC, MX, NS, SPF)\n      \"TTL\": 1,  # Time to live for the DNS record (1 = auto)\n      \"PROXIED\": false  # Proxy through Cloudflare (true or false)\n    }\n    // Add more Cloudflare configurations as needed\n  ]\n}\n\n```\n\n## Usage\n### Service Mode\n  - If running in service mode, the script will continuously monitor IP changes and update Cloudflare DNS records accordingly.\n  \n\n### Cron Mode\n  - If running in cron mode, the script will update Cloudflare DNS records only when there is a change in the public IP address. \n\n### Running once configured\n```\npython cloudflare_dns_updater.py\n```\n\n\n## Get Cloudflare API Token and Zone ID\n\n**1). Cloudflare API Token:** \n\n- Go to Cloudflare Dashboard.\n- Navigate to \"Profile\" and select \"API Tokens.\"\n- Click on \"Create Token\" and choose the \"Edit zone DNS\" template.\n- Assign the token a name, and make sure it has the necessary permissions.\n- Copy the generated API token.\n-  [Cloudflare API Tokens Link](https://dash.cloudflare.com/profile/api-tokens)\n\n**2.) Zone ID:**\n\n- Go to Cloudflare Dashboard.\n- Select the domain for which you want to update DNS records.\n- The Zone ID can be found on the right side of the Overview page under the \"Zone Information\" section.\n\n## Logging\nLogs are written to the **ipchange.log** file in the specified basePath.\n\n## Important Note\nThis script currently supports only IPV4 addresses. If you have IPV6, you'll need to modify the code to support it.\n\n## License\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Acknowledgments\n- Special thanks to [Cloudflare](https://www.cloudflare.com) for their awesome DNS services.\n- [ipify.org](https://www.ipify.org) for providing a free service that fetches public ip addresses .\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitachi1621%2Fcloudflare-dns-updater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitachi1621%2Fcloudflare-dns-updater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitachi1621%2Fcloudflare-dns-updater/lists"}