Skip to content

Instantly share code, notes, and snippets.

@scheckmedia
Created May 13, 2017 16:51
Show Gist options
  • Save scheckmedia/74b7a41f27880849e75112c7984b4a64 to your computer and use it in GitHub Desktop.
Save scheckmedia/74b7a41f27880849e75112c7984b4a64 to your computer and use it in GitHub Desktop.
simple dyndns updater in python for feste-ip.net
#!/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