Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57041 > unrolled thread
| Started by | Jérôme <jerome@jolimont.fr> |
|---|---|
| First post | 2013-10-18 13:19 +0200 |
| Last post | 2013-10-18 13:19 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: urllib2 timeout issue Jérôme <jerome@jolimont.fr> - 2013-10-18 13:19 +0200
| From | Jérôme <jerome@jolimont.fr> |
|---|---|
| Date | 2013-10-18 13:19 +0200 |
| Subject | Re: urllib2 timeout issue |
| Message-ID | <mailman.1218.1382095070.18130.python-list@python.org> |
Thu, 17 Oct 2013 15:55:06 +0200 Ervin Hegedüs a écrit: > Has your router/modem any HTTP proxy feature? If yes, maybe the > proxy gives the late answer. I don't think so. I didn't find anything like this in the config. > Anyway, if you don't have proxy, and the DNS error cames from > local system, you can try to decrease it via resolv.conf: > > nameserver 1.2.3.4 > options timeout:2 > > It's just an idea... but maybe... > > Note that the 2 seconds for DNS timeout in resolv.conf may sound crazy, > because the _real_slow_ DNS answers will be timeouted for any > application - just take a test with it. Yes. See my former message : > I found this on my server's config: > > options timeout:1 > > I added it to /etc/resolv.conf on my Pi and PC and I get a much shorter > timeout, yet still longer than the value I enter, longer than I expect, and > longer that what I have on other machines (instantaneous). > > But at least I see something happening. This was not a really satisfying solution. Besides, I'd rather solve the issue in the software, so that it works anywhere without the user having to play with DNS config and all. Even if the discussion on my DNS config is interesting, my question was about urllib2.urlopen() timeout. I thought the timeout parameter was meant to escape those long delays. Apparently, it is not. According to this SO topic: http://stackoverflow.com/questions/14127115/python-2-6-urlib2-timeout-issue urllib2 does not do that. Some workarounds are suggested. Perhaps the simplest solution for me would be to create my own urlopen() function, that would call urllib2's, and add a timeout in there. I don't get the logic, here. I would call it a bug in urllib2, but I won't allow myself to do that until I've understood the explanation on SO. -- Jérôme
Back to top | Article view | comp.lang.python
csiph-web