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


Groups > comp.lang.python > #53470

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

Path csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'python,': 0.02; 'url:pypi': 0.03; 'subject:skip:s 10': 0.07; 'way:': 0.09; 'bug': 0.12; '*i*': 0.16; 'ah,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:slow': 0.16; 'susceptible': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'mon,': 0.24; 'source': 0.25; 'nearly': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'host': 0.29; 'correct': 0.29; 'chris': 0.29; 'external': 0.29; 'patch': 0.29; 'subject:) ': 0.29; 'message- id:@mail.gmail.com': 0.30; 'go.': 0.31; 'sep': 0.31; 'file': 0.32; 'url:python': 0.33; 'core': 0.34; 'subject:from': 0.34; 'could': 0.34; 'problem': 0.35; 'subject: (': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'really': 0.36; 'raising': 0.36; "didn't": 0.36; 'entry': 0.36; 'method': 0.36; 'possible': 0.36; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'address.': 0.39; 'course': 0.61; 'address,': 0.75; '(according': 0.84; 'perfect!': 0.84; 'subject:skip:g 10': 0.84; 'mean.': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=QN5FqE30ucukcPfPxjRzuAHNLRfPf90BF8lbN8H2t1Y=; b=hWifXGkFJfDGbnbBFog+wyZF7j+zchCJGOiO/qQc6ExIOFNXtYsixfaLBtIntOKnHg xQn2dCKojBkz4MGf7kK2545eOevtiD4zIJE4fsf0s/5tsAUeYtcQuG9uqAL4vrMcXZ2f TDQO6eqA+iB0CaOLWHt2inKc2KL4q91aWJNN6zoBPUWt3IZgxJIr6SkIj8obYyZmNK+b hYfC3c6Tnqm1qHHWUL8Se8wKQYtvQYUhtXvHox6cZI3CJpSzklurWfalzJjxv62MMINp 35xHZfSN4pkE9ZpCl8WTf0+iGvJk/IXiVO715ioLr7w7EHUC7Tcdxn+ItispZmbrgRx6 Ch/A==
MIME-Version 1.0
X-Received by 10.58.100.234 with SMTP id fb10mr22821834veb.5.1378118532502; Mon, 02 Sep 2013 03:42:12 -0700 (PDT)
In-Reply-To <00843d58-db21-4cf0-9430-85362a1dd66f@googlegroups.com>
References <b9f77b6f-3a65-407a-aff5-5677be2ba228@googlegroups.com> <mailman.446.1378035456.19984.python-list@python.org> <9cca25d5-186d-4a92-893c-f7985fad7a55@googlegroups.com> <mailman.459.1378069438.19984.python-list@python.org> <00843d58-db21-4cf0-9430-85362a1dd66f@googlegroups.com>
Date Mon, 2 Sep 2013 20:42:12 +1000
Subject Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.479.1378118535.19984.python-list@python.org> (permalink)
Lines 21
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1378118535 news.xs4all.nl 15967 [2001:888:2000:d::a6]:43302
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:53470

Show key headers only | View raw


On Mon, Sep 2, 2013 at 3:28 PM,  <anntzer.lee@gmail.com> wrote:
> On Sunday, September 1, 2013 2:03:56 PM UTC-7, Chris Angelico wrote:
>
>> > I tried using netifaces (https://pypi.python.org/pypi/netifaces) which seems to rely on getifaddrs (according to the doc, I didn't check the source).  Again, it returns nearly instantaneously the correct IP address.
>>
>> Perfect!
>>
>> ChrisA
>
> Not really for my use case -- it isn't that *I* want to know my public IP address, but rather that IPython wants to know it.  Of course I could patch IPython's source to use netifaces but that sounds like an overkill.
>
> As it happens I found a better way: just add the proper entry to /etc/hosts.

Ah, I see what you mean.

If it were possible with core Python, I would recommend raising a bug
with IPython, as the current method is susceptible to external issues.
But to just get your problem solved, yes, a host file entry sounds
like it's the best way to go.

ChrisA

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


Thread

gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-08-31 17:03 -0700
  Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Roy Smith <roy@panix.com> - 2013-08-31 21:01 -0400
    Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-08-31 21:51 -0700
      Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Michael Torrie <torriem@gmail.com> - 2013-08-31 23:06 -0600
        Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-09-01 10:13 -0700
      Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Roy Smith <roy@panix.com> - 2013-09-01 06:57 -0400
  Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Chris Angelico <rosuav@gmail.com> - 2013-09-01 21:37 +1000
    Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-09-01 13:37 -0700
      Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Chris Angelico <rosuav@gmail.com> - 2013-09-02 07:03 +1000
        Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-09-01 22:28 -0700
          Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Chris Angelico <rosuav@gmail.com> - 2013-09-02 20:42 +1000
          Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Roy Smith <roy@panix.com> - 2013-09-02 08:45 -0400
            Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) anntzer.lee@gmail.com - 2013-09-02 10:52 -0700
              Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow) Chris Angelico <rosuav@gmail.com> - 2013-09-03 07:12 +1000

csiph-web