Python DNS resolution

The only DNS resolution related things online I could find are for the dnspython library.

I seems that with this library I have to perform separate A,AAA and CName queries, then for the CName do the same again recursively.

Is there not a simpler way to get a list of IP address for a DNS name?

I am scraping the CentOS mirror web page to get a list of mirrors and turn that into a list of IP address I can use on my firewall to allow servers to update.

Could you use something like pydig?

Based on the examples given, it seems to have the same problem.

Canonical answer is socket.getaddrinfo, however the returned list of tuples/ip addresses returned might not be exhaustive.

What DNS servers are your machines using? Maybe you could look at the --ipset feature of dnsmasq… and use Python only to convert a set of mirrors to a dnsmasq config fragment.

I’m using my ISP’s DNS servers.
Ultimately it isn’t that big of a deal to use dnspython or pydig if I write a recursive function on CName types (just in case the CName points to another CName). I was just being lazy is all.

Thanks though!