Giter Club home page Giter Club logo

cloudflare-dns-update's Introduction

Update Cloudflare DNS Record Script

This script automatically updates a Cloudflare DNS record with the current external IP address of the machine running the script. It is designed to be a more readable and maintainable Python version of an older shell script.

Features

  • Configuration Loading: Reads configuration parameters from a JSON file.
  • IP Address Handling: Retrieves the current external IP address and checks if it has changed since the last update.
  • Cloudflare Integration: Uses Cloudflare API to get Zone ID and Domain ID, and updates the DNS record if the IP address has changed.
  • Error Handling: Provides error messages and retries for network operations to ensure reliability.
  • Usage: The script is designed to be run from the command line with a configuration file as an argument.

Prerequisites

  • Python 3.x
  • requests library (can be installed via pip install requests)

Usage

  1. Install the requests library:
    pip install requests
    
  2. Create a configuration file (config.json) with the following structure:
{
    "LAST_IP_FILE": "last_ip.txt",
    "CF_EMAIL": "[email protected]",
    "CF_TOKEN": "your-cloudflare-api-token",
    "CF_ZONE_NAME": "example.com",
    "CF_DOMAIN_NAME": "sub.example.com"
}
  1. Run the script:
python update_cloudflare_dns.py config.json

cloudflare-dns-update's People

Contributors

sd416 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.