Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #55068
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <airween@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.077 |
| X-Spam-Evidence | '*H*': 0.85; '*S*': 0.00; 'subject:query': 0.07; 'dependency': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'localhost': 0.16; 'modul': 0.16; 'outdated': 0.16; 'twisted': 0.16; 'wrote:': 0.18; 'library': 0.18; 'bit': 0.19; 'not,': 0.20; 'seems': 0.21; 'import': 0.22; 'cc:addr:python.org': 0.22; 'header :User-Agent:1': 0.23; 'sends': 0.24; 'skip:` 20': 0.24; 'fairly': 0.24; 'mon,': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'query': 0.26; 'code:': 0.26; 'header:In-Reply- To:1': 0.27; 'resolution': 0.29; 'specified': 0.30; "i'm": 0.30; 'requests': 0.31; "skip:' 10": 0.31; '-0700,': 0.31; 'sep': 0.31; 'allows': 0.31; 'linux': 0.33; 'actively': 0.33; 'skip:d 20': 0.34; 'knows': 0.35; 'but': 0.35; 'there': 0.35; 'maintained': 0.36; 'hi,': 0.36; 'two': 0.37; 'project': 0.37; 'server': 0.38; 'handle': 0.38; 'skip:[ 10': 0.38; 'called': 0.40; 'skip:u 10': 0.60; 'easy': 0.60; 'most': 0.60; 'from:charset:utf-8': 0.61; 'simple': 0.61; 'content-disposition:inline': 0.62; 'different': 0.65; '30,': 0.65; 'to:addr:gmail.com': 0.65; 'here': 0.66; 'sample': 0.67; 'lightweight': 0.84; 'michel': 0.84; 'albert': 0.91; 'received:86': 0.91; 'received:hu': 0.93; '2013': 0.98 |
| X-Spam-Flag | NO |
| X-Spam-Score | -1.912 |
| X-Spam-Level | |
| X-Spam-Status | No, score=-1.912 tagged_above=-20 required=4 tests=[ALL_TRUSTED=-1, AWL=0.086, BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, NML_ADSP_CUSTOM_MED=0.9] autolearn=no |
| Date | Mon, 30 Sep 2013 14:54:41 +0200 |
| From | Ervin Hegedüs <airween@gmail.com> |
| To | Michel Albert <exhuma@gmail.com> |
| Subject | Re: DNS query against a specific server. |
| References | <634fa158-1d15-4a7e-ac0f-7a3f57f55cc7@googlegroups.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Disposition | inline |
| In-Reply-To | <634fa158-1d15-4a7e-ac0f-7a3f57f55cc7@googlegroups.com> |
| User-Agent | Mutt/1.5.20 (2009-06-14) |
| Cc | python-list@python.org |
| 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.482.1380545720.18130.python-list@python.org> (permalink) |
| Lines | 39 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1380545720 news.xs4all.nl 15992 [2001:888:2000:d::a6]:42759 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:55068 |
Show key headers only | View raw
Hello,
On Mon, Sep 30, 2013 at 04:42:29AM -0700, Michel Albert 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.
>
there is a dns modul for Python (I don't know is it part of
standard Python library or not), on most Linux distribution you
can find it, eg. in Debian it's called python-dnspython.
It can handle different nameserver, than OS knows - here is a
sample code:
import dns.resolver
r = dns.resolver.Resolver()
r.namerservers = ['127.0.0.1']
# or any other IP, in my case I'm using PDNS, which have two
# parts: a recursor and a resolver; recursor allows requests only
# on localhost
mxservers = r.query("python.org", 'MX').response
hth,
a.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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