Skip to content

Instantly share code, notes, and snippets.

@axeII
Created November 11, 2018 19:18
Show Gist options
  • Save axeII/b32e001d79352d589218306ab4e0f601 to your computer and use it in GitHub Desktop.
Save axeII/b32e001d79352d589218306ab4e0f601 to your computer and use it in GitHub Desktop.
Update ddns on namecheap
from requests import post
from urllib.request import urlopen
def update_ddns():
host = "@" # means no prefix for your domain
domain_name = "domain.com"
password = "password"
my_ip = urlopen('http://ip.42.pl/raw').read().decode("utf-8")
url = "https://dynamicdns.park-your-domain.com/update?host={}&domain={}&password={}&ip={}".format(
host, domain_name,password,my_ip
)
return post(url)
if __name__ == "__main__":
data = update_ddns()
if data.status_code == 200:
print("IP addres updated")
else:
print("There was some error")
print(data.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment