Ramashish Baranwal wrote:
> Hi,
>
> Apologies if this is has been answered before. How do I send changes
> to DNS back to the server?
>
> e.g.
>
> # get the zone
> domain = 'mydomain.com'
> answers = dns.resolver.query(domain, 'NS')
> ns = []
> for rdata in answers:
>     ns.append(n)
>
> # get zone from first nameserver
> zone = dns.zone.from_xfr(dns.query.xfr(ns[0], domain))
>
> # modifications
> update = dns.Update(zone)
>   
that should be dns.update.Update(zone), and you'll probably need to use 
TSIG too.  See the update example at 
http://www.dnspython.org/examples.html for more details.
> update.add(...)
> update.delete(...)
>   
Once you've made your update, all you have to do is send it, like this:

|response = dns.query.tcp(update, ns[0])

I used ns[0] since that's what you were using, but it's better to use the SOA 
MNAME field as the name of the master server.
E.g.:

answers = dns.resolver.query(domain, 'SOA')
for rdata in answers:
  mname = rdata.mname
||response = dns.query.tcp(update, mname)|

|
|||

_______________________________________________
dnspython-users mailing list
[email protected]
http://woof.play-bow.org/mailman/listinfo/dnspython-users

Reply via email to