DNS resolution in python?
I have to send a lot of mails to customers out over the next few weeks telling them about changes to our shared hosting platform. Obviously, I’m writing a script to handle the heavy working for me. Previously, I’ve been using a smarthost but it means I don’t get a lot of the errors. I thought I’d change to resolving the MX record for each domain myself and then e-mailing the customers SMTP mailserver directly. First thing I’ve run into is that Python doesn’t seem to have a DNS resolver built in as a standard module. I found the ADNS module but it doesn’t have very good documentation – shouldn’t moan but I wish module writers would do decent documentation! At the moment it’s not clear how you’re supposed to handle failures or how you get exceptions.