Browse Source

List of available sub-domains on the domain supplied in the config.ini file that are maintaind by py.dyndns are marked with a check mark

master
Rune Olsen 1 year ago
parent
commit
411b10652d
1 changed files with 12 additions and 1 deletions
  1. +12
    -1
      py-dyndns.py

+ 12
- 1
py-dyndns.py View File

@@ -68,14 +68,25 @@ def runupdate():


def listdomains():
LocalDonains = []
for section in config.sections():
if not config.has_option(section, 'subdomainid'):
continue
for subdomainid, value in config.items(section, 'subdomainid'):
LocalDonains.append(value)
req = urllib.request.Request('https://api.digitalocean.com/v2/domains/' + domain_name + '/records/')
req.add_header('Content-Type', 'application/json')
req.add_header('Authorization', 'Bearer ' + api)
current = urllib.request.urlopen(req)
remote = current.read().decode('utf-8')
remoteData = json.loads(remote)
print('Domains in config.ini is marked with a ['+u'\u2713'+']')
print('================================================')
for k in remoteData["domain_records"]:
print('Name : '+k['name']+' Id : '+str(k['id'])+' (IP: '+str(k['data'])+')')
if str(k['id']) in LocalDonains:
print('['+u'\u2713'+'] Name : '+k['name']+' Id : '+str(k['id'])+' (IP: '+str(k['data'])+')')
else:
print('Name : '+k['name']+' Id : '+str(k['id'])+' (IP: '+str(k['data'])+')')


def listcurrent():


Loading…
Cancel
Save