Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.030 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'python,': 0.02; 'subject:query': 0.07; 'dependency': 0.09; 'lookup': 0.09; 'cc:addr:python-list': 0.11; 'outdated': 0.16; 'received:mac.com': 0.16; 'stdout': 0.16; 'twisted': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'received:10.0.1': 0.19; 'not,': 0.20; 'seems': 0.21; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**1': 0.23; 'sends': 0.24; 'skip:` 20': 0.24; 'fairly': 0.24; 'cheers,': 0.24; 'looks': 0.24; 'cc:no real name:2**0': 0.24; 'query': 0.26; 'resolution': 0.29; 'am,': 0.29; 'specified': 0.30; 'url:mailman': 0.30; 'sep': 0.31; 'allows': 0.31; 'url:python': 0.33; 'actively': 0.33; 'skip:s 30': 0.35; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'maintained': 0.36; 'url:listinfo': 0.36; 'charset:us- ascii': 0.36; 'hi,': 0.36; 'received:10.0': 0.36; 'url:org': 0.36; 'project': 0.37; 'received:10': 0.37; 'server': 0.38; 'received:17': 0.38; 'bill': 0.39; 'url:mail': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'hope': 0.61; 'simple': 0.61; 'name': 0.63; '30,': 0.65; 'to:addr:gmail.com': 0.65; 'guaranteed': 0.75; 'header:In-reply-to:1': 0.84; 'lightweight': 0.84; 'michel': 0.84; '2013,': 0.91; 'albert': 0.91 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794,1.0.431,0.0.0000 definitions=2013-09-29_03:2013-09-27,2013-09-29,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1308280000 definitions=main-1309300052 Content-type: text/plain; charset=us-ascii MIME-version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: DNS query against a specific server. From: William Ray Wing In-reply-to: <634fa158-1d15-4a7e-ac0f-7a3f57f55cc7@googlegroups.com> Date: Mon, 30 Sep 2013 08:36:34 -0400 Content-transfer-encoding: quoted-printable References: <634fa158-1d15-4a7e-ac0f-7a3f57f55cc7@googlegroups.com> To: Michel Albert X-Mailer: Apple Mail (2.1510) Cc: python-list@python.org, William Ray Wing X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380544612 news.xs4all.nl 15959 [2001:888:2000:d::a6]:59422 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55065 On Sep 30, 2013, at 7:42 AM, Michel Albert wrote: > Hi, >=20 > ``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? >=20 > 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. >=20 > Is there not an actively maintained lightweight solution? If not, I = will go with twisted. >=20 >=20 > Cheers, > Mich. > --=20 > 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 =3D subprocess.Popen(['nslookup', '' = ],stderr =3D subprocess.PIPE, stdout =3D = subprocess.PIPE).communicate()[0] Hope this helps, Bill=