diff options
Diffstat (limited to 'Lib/ftplib.py')
-rw-r--r-- | Lib/ftplib.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/ftplib.py b/Lib/ftplib.py index 22aff51acb..012671bfec 100644 --- a/Lib/ftplib.py +++ b/Lib/ftplib.py @@ -115,7 +115,7 @@ class FTP: if user: self.login(user, passwd, acct) - def connect(self, host='', port=0): + def connect(self, host='', port=0, timeout=None): '''Connect to host. Arguments are: - host: hostname to connect to (string, default previous host) - port: port to connect to (integer, default previous port) @@ -124,6 +124,8 @@ class FTP: self.host = host if port > 0: self.port = port + if timeout is not None: + self.timeout = timeout self.sock = socket.create_connection((self.host, self.port), self.timeout) self.af = self.sock.family self.file = self.sock.makefile('rb') |