Created
November 11, 2018 19:18
-
-
Save axeII/b32e001d79352d589218306ab4e0f601 to your computer and use it in GitHub Desktop.
Update ddns on namecheap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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