On Sep 30, 2013, at 7:42 AM, Michel Albert <exh...@gmail.com> wrote:

> Hi,
> 
> ``socket.gethostbyname`` sends the DNS resolution query to the DNS server 
> specified by the OS. Is there an easy way to send a query to a *different* 
> server?
> 
> I see that twisted.names allows you to do this, but, having all of twisted as 
> dependency to my project when all I need to do is a simple DNS query seems a 
> bit extreme. I also found pydns, but that looks fairly outdated and 
> unmaintained.
> 
> Is there not an actively maintained lightweight solution? If not, I will go 
> with twisted.
> 
> 
> Cheers,
> Mich.
> -- 
> https://mail.python.org/mailman/listinfo/python-list

It isn't pure python, but you would be pretty much guaranteed a maintained 
solution if you use the name server lookup in your OS.  Something like:

        import subprocess
        nsl_reslt = subprocess.Popen(['nslookup', '<insert name nere>' ],stderr 
= subprocess.PIPE, stdout = subprocess.PIPE).communicate()[0]


Hope this helps,
Bill
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to