nc_dnsapi
A simple API wrapper for the netcup DNS API
from nc_dnsapi import Client, DNSRecord
customer = 123456
api_key = "your-personal-api-key"
api_password = "your-private-api-password"
with Client(customer, api_key, api_password) as api:
records = api.dns_records("example.com")
for record in records:
print(record)
zone = api.dns_zone("example.com")
print(zone)
api.update_dns_record("example.com", DNSRecord("my-hostname", "A", "127.0.0.2", id=108125))
api.update_dns_record("example.com", [ DNSRecord("my-hostname", "A", "127.0.0.2", id=108125),
DNSRecord("my-hostname2", "A", "127.0.0.2", id=108126)])
api.delete_dns_record("example.com", DNSRecord("my-hostname", "A", "127.0.0.2", id=108125))
api.add_dns_record("example.com", DNSRecord("another-host", "AAAA", "::1"))
zone = api.dns_zone("example.com")
zone.refresh = 3600
api.update_dns_zone("example.com", zone)