This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add a settimeout to ftplib.FTP object
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: facundobatista Nosy List: collinwinter, facundobatista, juanval
Priority: normal Keywords:

Created on 2005-04-06 18:52 by juanval, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg54428 - (view) Author: Juan Antonio Valiño García (juanval) Date: 2005-04-06 18:52
It will be usefull that the FTP object of ftplib had a 
settimeout method to setup a timeout for the connection, 
because the only way of doing this is to use the 
socket.setdefaulttimeout method, and this is very 
dangerous when you are using threads. 
 
Thanks and keep up the work ! 
msg54429 - (view) Author: Collin Winter (collinwinter) * (Python committer) Date: 2007-03-30 07:23
Facundo, I believe you're doing something along these lines, right?
msg54430 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2007-03-30 13:02
It's already in the trunk, you can do this:

>>> ftp = ftplib.FTP("localhost", timeout=30)

... or ...

>>> ftp = ftplib.FTP()
>>> ftp.connect("localhost", timeout=30)

... or ...

>>> ftp = ftplib.FTP(timeout=30)
>>> ftp.connect("localhost")

... or ...

>>> ftp = ftplib.FTP()
>>> ftp.timeout = 30
>>> ftp.connect("localhost")


:D

Thanks Collin!
History
Date User Action Args
2022-04-11 14:56:10adminsetgithub: 41816
2005-04-06 18:52:52juanvalcreate