Created
May 13, 2017 16:51
-
-
Save scheckmedia/74b7a41f27880849e75112c7984b4a64 to your computer and use it in GitHub Desktop.
simple dyndns updater in python for feste-ip.net
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
#!/usr/bin/env python | |
import urllib2, base64, syslog | |
username = "username" | |
password = "password" | |
host = "hostname.feste-ip.net" | |
url = "https://members.feste-ip.net/nic/update?hostname=%s" % (host) | |
auth = base64.b64encode('%s:%s' % (username, password)) | |
if __name__ == '__main__': | |
try: | |
syslog.syslog(syslog.LOG_INFO, 'DYNDNS: start update dyndns') | |
req = urllib2.Request(url) | |
req.add_header("Authorization", "Basic %s" % auth) | |
res = urllib2.urlopen(req) | |
syslog.syslog(syslog.LOG_INFO, 'DYNDNS: update successfull') | |
except urllib2.HTTPError as e: | |
syslog.syslog(syslog.LOG_ERR, 'DYNDNS: failed to update -- status code: %s -- error: %s' % (e.code, e.read())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment