0

Can I add timepout for ftps connection and each command on ftp server ?

r  = ftpslib.FTP_TLS()
...
1

1 Answer 1

1

In python >= 2.6, the timeout option has been added to FTPconstructor. It will be used for each blocking operation (ie connection, receive, sending...). In python >= 2.7, the FTP_TLS object has been added (with timeout).

In python < 2.7, you'll have to modify the default global timeout on socket module with socket.setdefaulttimeout(timeout) before creating the FTP or FTP_TLS object.

Sign up to request clarification or add additional context in comments.

1 Comment

@eryksun : Thanks, I updated my answer, I didn't notice the new in version 2.7

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.