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


Groups > comp.lang.python > #56877

Re: urllib2 timeout issue

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <vincent.vandevyvre@swing.be>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'url:launchpad': 0.05; 'socket': 0.07; 'urllib2': 0.07; 'python': 0.11; '"python': 0.16; 'from:addr:swing.be': 0.16; 'from:addr:vincent.vandevyvre': 0.16; 'from:name:vincent vande vyvre': 0.16; 'message-id:@swing.be': 0.16; 'oqapy': 0.16; 'paqager': 0.16; 'received:mobistar.be': 0.16; 'seconds.': 0.16; 'subject:issue': 0.16; 'url:oqapy': 0.16; 'url:paqager': 0.16; 'url:qarte': 0.16; 'v.v.': 0.16; 'all.': 0.16; 'server,': 0.19; 'not,': 0.20; 'thanks.': 0.20; 'example': 0.22; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'script': 0.25; 'suggested': 0.26; 'skip:" 20': 0.27; 'header:In- Reply-To:1': 0.27; 'tried': 0.27; "i'm": 0.30; 'run': 0.32; 'something': 0.35; 'but': 0.35; 'version': 0.36; "didn't": 0.36; 'skip:- 20': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'normal.': 0.68; 'results': 0.69; 'difference.': 0.84
Date Wed, 16 Oct 2013 12:04:22 +0200
From Vincent Vande Vyvre <vincent.vandevyvre@swing.be>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version 1.0
To python-list@python.org
Subject Re: urllib2 timeout issue
References <acf47c27e418951eae9d050f8d3ccfba@jolimont.fr>
In-Reply-To <acf47c27e418951eae9d050f8d3ccfba@jolimont.fr>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
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.1111.1381918324.18130.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1381918324 news.xs4all.nl 15986 [2001:888:2000:d::a6]:53178
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:56877

Show key headers only | View raw


Le 16/10/2013 11:21, Jérôme a écrit :
> Hi all.
>
> I'm having troubles with urllib2 timeout.
>
> See the following script :
>
> ----------------------------
> import urllib2
> result = urllib2.urlopen("http://dumdgdfgdgmyurl.com/")
> print result.readline()
> ----------------------------
>
> If run on my Debian Wheezy computer, or on my Debian Squeeze server,
> the answer is instantaneous :
>
> [...]
> urllib2.URLError: <urlopen error [Errno -2] Name or service not known>
>
> When run on my Raspberry Pi with Raspian Wheezy, the answer is
> identical but it takes 10 seconds.
>
> I tried
>
>      result = urllib2.urlopen("http://dumdgdfgdgmyurl.com/", timeout=5)
>
> but I get the same results : instantaneous on Debian, 10 secondes on
> RPi.
>
> I also added this, as suggested on some StackOverflow pages :
>
>      import socket
>      socket.setdefaulttimeout(5)
>
> and it didn't make any difference.
>
> In both cases, Python version is "Python 2.7.3".
>
> Am I missing something ?
>
> Thanks.
>
The url "dumdgdfgdgmyurl.com/" is just an example ?

If not, the result  <urlopen error [Errno -2] Name or service not known> 
is normal.
-- 
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte 
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>

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


Thread

Re: urllib2 timeout issue Vincent Vande Vyvre <vincent.vandevyvre@swing.be> - 2013-10-16 12:04 +0200
  Re: urllib2 timeout issue Tobiah <toby@tobiah.org> - 2013-10-16 09:06 -0700

csiph-web