Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55065

Re: DNS query against a specific server.

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 <wrw@mac.com>
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 <wrw@mac.com>
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 <exhuma@gmail.com>
X-Mailer Apple Mail (2.1510)
Cc python-list@python.org, William Ray Wing <wrw@mac.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.481.1380544612.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Sep 30, 2013, at 7:42 AM, Michel Albert <exhuma@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

DNS query against a specific server. Michel Albert <exhuma@gmail.com> - 2013-09-30 04:42 -0700
  Re: DNS query against a specific server. William Ray Wing <wrw@mac.com> - 2013-09-30 08:36 -0400
    Re: DNS query against a specific server. Michel Albert <exhuma@gmail.com> - 2013-09-30 05:45 -0700
      Re: DNS query against a specific server. Chris Angelico <rosuav@gmail.com> - 2013-09-30 22:56 +1000
      Re: DNS query against a specific server. "Gisle Vanem" <gvanem@yahoo.no> - 2013-09-30 15:35 +0200
  Re: DNS query against a specific server. Ervin Hegedüs <airween@gmail.com> - 2013-09-30 14:54 +0200
    Re: DNS query against a specific server. Michel Albert <exhuma@gmail.com> - 2013-09-30 06:04 -0700

csiph-web