Skip to main content

Dynu Client in Python - Dynamic DNS

Dynamic Ip was something which restricts people to test or launch their small web applications. Later some websites started offering their subdomains for free to normal people so they could get a permanent web address for web application/sites.

All you need to do is,
  • Point your dynamic IP to the provided subdomain.
  • Update the dynamic IP regularly. So IP change won't restrict app's performance and gives near to 100% uptime. is a pioneer in providing this service. In this post, I'm sharing python code which regularly updates your IP to dynu's dynamic service. In the code, from different service we will retrieve current IP address. Next we will load different parameters needed, in addition the password is programmatically converted to md5 for security reasons. Along with the parameters, new IP is updated to Dynu Dynamic DNS Service.

Please note that the code will update only IPv4 address. Please modify the code and configuration if you have a IPv6 service.
Check the GitHub repo for complete details.

Add this code to a cron job(Linux) or task scheduler(windows)

Python Libraries required,


import configparser import requests import re import hashlib configParser = configparser.RawConfigParser() configFilePath = r'dynuParams.config' dynuUpdateUrl = configParser.get('dynuParams', 'dynuUpdateUrl') hostName = configParser.get('dynuParams', 'hostName') myipv6 = configParser.get('dynuParams', 'myipv6') username = configParser.get('dynuParams', 'username') ipSources = configParser.get('dynuParams', 'ipSources') password = configParser.get('dynuParams', 'password') print("Dynu Client Started") try: m = hashlib.md5() m.update(password.encode('utf-8')) md5Password = m.hexdigest() print(md5Password) for ipSource in ipSources.split(","): print("IP fetching source - "+ipSource) response = requests.get(ipSource) ip = response.json()["ip"] print("IP found - "+ip) if (re.match(r"^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$", ip)): break; print("Started updating IP in Dynu") response = requests.get(url=dynuUpdateUrl, params={"hostname": hostName, "myip": ip, "myipv6": myipv6, "username": username, "password": md5Password}) print("Response from Dynu - "+str(response.content)) except Exception as e: print ("Exception - "+str(e))


Popular posts from this blog

Setting up Python Flask server on internet via Port forwarding

In this post we will cover topics;

Starting a server using Python Flask.Accessing server in Local Network.Adding a Port Forwarding rule in NAT settings.Accessing server in Internet via public IP.Difference between static IP and dynamic IP.

Step 1 :-

As the first step, we need to setup a server on our system.A server exposes your code to a particular port.Some examples are Apache Tomcat, Spring boot (inbuilt), Python Django (inbuilt), Nginx.
Here we have a simple server in Python Flask.

For a GET request in root path the server returns a "Hello World!".That's it.
Going to start the server on my local IP address( at default flask port(5000) using below commands,
$flask run  --host=

Step 2 :-

For security purpose all ports for external communication is closed by router's firewall by default. So no communication can be done to outside world. For same reason our server won't be available to other devices.
For our…

Automate Blog Post creation using Blogger APIs and Python

This article will discuss the following topics,

Blogger's REST APIs.Google's OAuth 2.0 playground.Accessing spreadsheet in Python.Creating blogger posts via Python.An experiment to automate blog post creation when you have structured data. I was searching for IFSC codes for some bank transactions and came across Reserve Bank's website, which has a list of excel files containing Bank Codes, Contact Info and related details of each bank's branch. This time I will be looking towards Bharat co-operative bank of Mumbai. Here is how the corresponding data looks like.
In the above picture, each row represents lots of details about each branch of the Bank. Let's think of creating a list of blog posts where each post gives IFSC codes of a particular branch along with address and contact details.

As the first step, I have created a blog in blogger. In the Blogger dashboard, Please also note the parameter called blog ID which is a kind of unique identifier to the blog. It is …

Creation of Orphan Process in Linux using Python

Hi all,

In this article we will learn about,
Orphan process in Linux/Unix.How orphan process is created ?Creation of orphan process using python.Usage of python modules - multiprocessing , subprocessOrphan Process :-

An orphan process is a child process whose parent got finished or terminated. After the termination of parent process, init process will adopt it.If you look into details, the parent pid(ppid) of an orphan will be 1 which is the pid of init. Sometimes orphan process is intentionally created for certain needs, like if you run an application and you don't want the process created by your application to be killed, even after closing the application.

Creation of Orphan process using Python :-

Here, we are going to create an orphan process through python code.
The logic behind the code is,

Create a process using python multiprocessing module and target function will be parent.
In parent function another process is spawned , making it's target function as child. Using su…