Closed paulehoffman closed 2 months ago
Sorry for not saying so above, but origin=
and relativize=
don't help. In fact, the third example on the doc page also fails with unknown rdatatype 'IN'
.
It can do it, you just need to tell it that's what you want, as by default it assumes you don't want classes at all (as this is more convenient for people say filling in a text box). To get what you want, just say rdclass=None
in the call. This will make it not assume that the rdclass is always IN, but instead will try to parse it, and if not present will use the default_rdclass
parameter.
import dns.zonefile
input = """example1.tld. 900 in a 1.2.3.4
example2.tld. in 900 a 1.2.3.4
example3.tld. 900 a 1.2.3.4"""
for rrs in dns.zonefile.read_rrsets(input, rdclass=None):
print(rrs)
Also the third example on the doc page works for me; did you have the rdclass=None
?
Also, I take responsibility for perhaps suboptimal API design here, but we're stuck with it now!
Got it. The doc made it unclear that, if the input might have classes, you need rdclass=None.
Describe the bug dns.zonefile.read_rrsets cannot handle lines with classes in them
To Reproduce Using the three lines:
Only the third line can be parsed. The first two get
unknown rdatatype 'in'
. All three are legitimate according to RFC 1035.Context (please complete the following information):