From 77cb0f2ea8179f7fb5f517d3d59b57ec5f523fd8 Mon Sep 17 00:00:00 2001 From: Martin Raspaud Date: Mon, 18 Sep 2023 13:59:57 +0200 Subject: [PATCH] Fix ftp downloading for older python versions --- trollsched/satpass.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/trollsched/satpass.py b/trollsched/satpass.py index 858162f..2f553ec 100644 --- a/trollsched/satpass.py +++ b/trollsched/satpass.py @@ -29,6 +29,8 @@ import operator import os import socket +import ssl +import sys from datetime import datetime, timedelta from functools import reduce as fctools_reduce from tempfile import gettempdir, mkstemp @@ -436,11 +438,13 @@ def get_aqua_terra_dumpdata_from_ftp(sat, dump_url): try: f = ftplib.FTP_TLS(url.netloc) except (socket.error, socket.gaierror) as e: - logger.error("cannot reach to %s " % HOST + str(e)) + logger.error("cannot reach to %s " % url.netloc + str(e)) f = None if f is not None: try: + if sys.version_info < (2, 7, 10): + f.ssl_version = ssl.PROTOCOL_SSLv23 f.login("anonymous", "guest") logger.debug("Logged in") except ftplib.error_perm: