X-Git-Url: https://wylark.com/src/infoex-autowx.git/blobdiff_plain/39fe90be8e9380b0a95d8c4f7c724117e71fc011..HEAD:/infoex-autowx.py diff --git a/infoex-autowx.py b/infoex-autowx.py index 8cab0c3..9df112c 100755 --- a/infoex-autowx.py +++ b/infoex-autowx.py @@ -27,6 +27,7 @@ import csv import datetime import logging import os +import socket import sys import time import urllib3 @@ -43,7 +44,7 @@ import zeep import zeep.cache import zeep.transports -__version__ = '3.4.4' +__version__ = '3.4.5' LOG = logging.getLogger(__name__) LOG.setLevel(logging.NOTSET) @@ -384,7 +385,10 @@ def main(): return 1 if not options.dry_run: - upload_csv(infoex['csv_filename'], infoex) + try: + upload_csv(infoex['csv_filename'], infoex) + except socket.timeout: + LOG.critical("FTP timed out") LOG.debug('DONE') return 0 @@ -852,7 +856,7 @@ def upload_csv(path_to_file, infoex_data): with open(path_to_file, 'rb') as file_object: LOG.debug("uploading FTP file '%s'", infoex_data['host']) ftp = FTP(infoex_data['host'], infoex_data['uuid'], - infoex_data['api_key']) + infoex_data['api_key'], timeout=10) ftp.storlines('STOR ' + path_to_file, file_object) ftp.close() file_object.close()