Code Monkey home page Code Monkey logo

python_ddns's Introduction

Welcome to Python Auto DDNS 👋

Version License: MIT Twitter: sffdfsfd

Script to set your home (or business) IP address via cloudflare dns on A-record domain record.

Specially used when you do not have a fixed IP address.

This script checks your current IP address by using the Amazon service checkip.amazonaws.com. The service checkip.amazonaws.com provides the public IP address of the client making the request. Please be sure that your device running this script is not behind a VPN.

Installation

do a git clone

git clone [email protected]:tvdsluijs/python_ddns.git

Go into the folder that was created

cd python_ddns

Create an environment when needed within the folder

# macOS/Linux
# You may need to run sudo apt-get install python3-venv first
python3 -m venv .venv

# Windows
# You can also use py -3 -m venv .venv
python -m venv .venv

Then install the needed requirements with

pip install -r requirements.txt

Create a config.ini from the config_sample.ini

NOTICE: KEEP your zone_id and API-Key to yourself!!!! Do not share with anyone!!!

With the following information

  • zone_id =
  • api_token =
  • ip_address_type = A
  • dns_name =

Prerequisites

For this script to work your need:

  1. A cloudflare account (pick the free one)
  2. Set a A-record, with current ip address to the desired domain / subdomain
  3. A zone_id, can be found on the right side of the screen when you scroll down
  4. A API-Key, also found on right side of screen, make sure the API-key is able to edit the DNS

Usage

python ddns.py

That's all folks!

Docker environment

Notice! Before building and running the Dockerfile please create your own config.ini file with the right information

You can als run a docker instance with this script (as you like running Dockers)

This docker is running the Alpine Python framework. It's smaller than 80Mb, so lightweight (the normal python mage is 980mb)! Great to run on a Raspberry Pi.

To create the Docker environment (I assume you already have docker running) do:

docker build -t auto_ddns .

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH or URL. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.

To run the docker (on the background) do:

docker run -d auto_ddns

That's all folks!

Author

👤 Theo van der Sluijs

Show your support

Give a ⭐️ if this project helped you! And a donation is always very welcome! (Just to buy a cup of coffee!)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update or create tests as appropriate.

License

MIT

python_ddns's People

Contributors

tvdsluijs avatar dependabot[bot] 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.