summaryrefslogtreecommitdiffstats
path: root/Lib/urllib.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2007-05-24 17:50:54 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2007-05-24 17:50:54 (GMT)
commit711a54ebdeb6ec7e099a8a2a1777161ebc13442d (patch)
treee43df36bc0b26a114ce83820a35ec8c5fa1df19a /Lib/urllib.py
parentdd96ca3d6b7e6091ccaea56044139ffe7228712c (diff)
downloadcpython-711a54ebdeb6ec7e099a8a2a1777161ebc13442d.zip
cpython-711a54ebdeb6ec7e099a8a2a1777161ebc13442d.tar.gz
cpython-711a54ebdeb6ec7e099a8a2a1777161ebc13442d.tar.bz2
Added an optional timeout parameter to urllib.ftpwrapper, with tests
(for this and a basic one, because there weren't any). Changed also NEWS, but didn't find documentation for this function, assumed it wasn't public...
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r--Lib/urllib.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index cecfbb0..167bdcb 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -819,19 +819,20 @@ def noheaders():
class ftpwrapper:
"""Class used by open_ftp() for cache of open FTP connections."""
- def __init__(self, user, passwd, host, port, dirs):
+ def __init__(self, user, passwd, host, port, dirs, timeout=None):
self.user = user
self.passwd = passwd
self.host = host
self.port = port
self.dirs = dirs
+ self.timeout = timeout
self.init()
def init(self):
import ftplib
self.busy = 0
self.ftp = ftplib.FTP()
- self.ftp.connect(self.host, self.port)
+ self.ftp.connect(self.host, self.port, self.timeout)
self.ftp.login(self.user, self.passwd)
for dir in self.dirs:
self.ftp.cwd(dir)