リモート FTP サーバーに接続してファイルをダウンロードする Python スクリプトがあります。私が接続しているサーバーはあまり信頼性が高くないため、転送が停止したり、転送速度が非常に遅くなったりすることがよくあります。ただし、エラーは発生しないため、スクリプトも停止します。
ftplib
関数でモジュールを使用しますretrbinary
。ダウンロードが中止されるまでのタイムアウト値を設定してから、転送を自動的に再試行/再開できるようにしたいと考えています (再開は便利ですが、ファイルが 300M 以下であるため、厳密には必要ではありません)。