0

I have all the resource record sets and resource types(cname,A,ns,mx). I wanted to create a dns file(BIND format) using easyzone, dnspython, dns libraries in python.

But I am getting an error -

Attribute Error : 'str' object has no attribute 'is_absolute'

Here is my basic code-

    from dns.zone import Zone
    from dns.rdataclass import *
    from dns.rdatatype import *
    zone1 = Zone(origin='example.com.')
    A_add = "example.com."
    print "Adding record of type A:", A_add
    rdataset = zone1.find_rdataset(A_add, rdtype=A, create=True)
    rdata = dns.rdtypes.IN.A.A(IN, A, address="192.168.10.30")
    rdataset.add(rdata, ttl=300)

I am getting error on rdataset = zone1.find_rdataset(A_add, rdtype=A, create=True).

How to create a dns file using any of the libraries mentioned above in python and how to resolve the issue?

idjaw
  • 25,487
  • 7
  • 64
  • 83
tom
  • 3,720
  • 5
  • 26
  • 48
  • What version of DNSPython are you using? It should work fine with A_add being a string (and just convert it to a dns.name.Name) – Chad S. Oct 20 '15 at 19:36
  • easyzone ==1.2.2 dnspython == 1.12.0 and can you please add a line to convert **A_add to dns.name.Name** because even after that the problem persist ! – tom Oct 20 '15 at 20:40
  • I did that, it works but now I am getting **AttributeError: 'module' object has no attribute 'CNAME'** and **AttributeError: 'module' object has no attribute 'A'** Errors in the lines **rdata = dns.rdtypes.ANY.CNAME.CNAME(IN, CNAME, target)** and **rdata = dns.rdtypes.IN.A.A(IN, A, address="192.168.10.30")**. I am importing it correctly although ! – tom Oct 21 '15 at 08:37

0 Answers0