mirror of
https://github.com/weewx/weewx.git
synced 2026-05-18 23:05:30 -04:00
Introduced FTP option secure_data. Fixes issue #284.
This commit is contained in:
@@ -27,7 +27,8 @@ class FtpUpload(object):
|
||||
passive = True,
|
||||
max_tries = 3,
|
||||
secure = False,
|
||||
debug = 0):
|
||||
debug = 0,
|
||||
secure_data = True):
|
||||
"""Initialize an instance of FtpUpload.
|
||||
|
||||
After initializing, call method run() to perform the upload.
|
||||
@@ -50,6 +51,11 @@ class FtpUpload(object):
|
||||
secure: Set to True to attempt an FTP over TLS (FTPS) session.
|
||||
|
||||
debug: Set to 1 for extra debug information, 0 otherwise.
|
||||
|
||||
secure_data: If a secure session is requested (option secure=True),
|
||||
should we attempt a secure data connection as well? This option is useful
|
||||
due to a bug in the Python FTP client library. See Issue #284.
|
||||
[Optional. Default is True]
|
||||
"""
|
||||
self.server = server
|
||||
self.user = user
|
||||
@@ -62,6 +68,7 @@ class FtpUpload(object):
|
||||
self.max_tries = max_tries
|
||||
self.secure = secure
|
||||
self.debug = debug
|
||||
self.secure_data = secure_data
|
||||
|
||||
def run(self):
|
||||
"""Perform the actual upload.
|
||||
@@ -99,9 +106,9 @@ class FtpUpload(object):
|
||||
|
||||
ftp_server.login(self.user, self.password)
|
||||
ftp_server.set_pasv(self.passive)
|
||||
if self.secure:
|
||||
if self.secure and self.secure_data:
|
||||
ftp_server.prot_p()
|
||||
syslog.syslog(syslog.LOG_DEBUG, "ftpupload: Secure connection to %s" % self.server)
|
||||
syslog.syslog(syslog.LOG_DEBUG, "ftpupload: Secure data connection to %s" % self.server)
|
||||
else:
|
||||
syslog.syslog(syslog.LOG_DEBUG, "ftpupload: Connected to %s" % self.server)
|
||||
break
|
||||
|
||||
@@ -314,7 +314,8 @@ class FtpGenerator(ReportGenerator):
|
||||
passive=to_bool(self.skin_dict.get('passive', True)),
|
||||
max_tries=int(self.skin_dict.get('max_tries', 3)),
|
||||
secure=to_bool(self.skin_dict.get('secure_ftp', False)),
|
||||
debug=int(self.skin_dict.get('debug', 0)))
|
||||
debug=int(self.skin_dict.get('debug', 0)),
|
||||
secure_data=to_bool(self.skin_dict.get('secure_data', True)))
|
||||
except Exception:
|
||||
syslog.syslog(syslog.LOG_DEBUG,
|
||||
"ftpgenerator: FTP upload not requested. Skipped.")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
weewx change history
|
||||
--------------------
|
||||
|
||||
3.8.0a1 10/xx/2017
|
||||
3.8.0a3 10/xx/2017
|
||||
|
||||
The `stats.py` example now works with heating and cooling degree days.
|
||||
Fixes issue #224.
|
||||
@@ -29,6 +29,9 @@ and allows additional headers to be added to the HTTP request object.
|
||||
MySQL error 2006 ("MySQL server has gone away") now gets mapped to
|
||||
`weedb.CannotConnectError`. PR #246
|
||||
|
||||
Whether to use a FTP secure data connection is now set separately
|
||||
from whether to authenticate using TLS. Fixes issue #284.
|
||||
|
||||
Corrected formatting used to report indoor temp and humidity to the
|
||||
Weather Underground.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user