[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

John Nagle report at bugs.python.org
Mon Sep 2 20:18:51 CEST 2013


New submission from John Nagle:

urllib2.open for an FTP url does not obey the timeout parameter.

Attached test program times out on FTP open after 21 seconds, even though the specified timeout is 60 seconds.  Timing is consistent; times have ranged from 21.03 to 21.05 seconds. Python documentation (http://docs.python.org/2/library/urllib2.html) says "The optional timeout parameter specifies a timeout in seconds for blocking operations like the connection attempt (if not specified, the global default timeout setting will be used). This actually only works for HTTP, HTTPS and FTP connections."  The documentation for Python 3 reads the same.

Open of ftp://ftp.sec.gov/edgar/daily-index failed after 21.05 seconds: <urlopen error ftp error: [Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond>

This was on Windows 7, but the same result is observed on Linux.  

(The FTP server at the U.S. Securities and Exchange Commission is now imposing a 20-second connection delay during busy periods.  This is causing our Python code that retrieves new SEC filings to fail.  It may be necessary to run the program at different times of the day to reproduce the problem.)

----------
components: Library (Lib)
files: edgartimeouttest.py
messages: 196800
nosy: nagle
priority: normal
severity: normal
status: open
title: urllib2.open FTP open times out at 20 secs despite timeout parameter
versions: Python 2.7
Added file: http://bugs.python.org/file31558/edgartimeouttest.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18907>
_______________________________________


More information about the Python-bugs-list mailing list