Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sftp_notice_publisher.py #308

Merged
merged 1 commit into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions ted_sws/notice_publisher/adapters/sftp_notice_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ class SFTPPublisher(SFTPPublisherABC):

"""

connection: pysftp.Connection = None
default_host = config.SFTP_HOST
default_user = config.SFTP_USER
default_pass = config.SFTP_PASSWORD
default_port = config.SFTP_PORT

def __init__(self, hostname=default_host, username=default_user, password=default_pass, port=default_port):
def __init__(self, hostname: str = None, username: str = None, password: str = None, port: str = None):
"""Constructor Method"""
# Set connection object to None (initial value)
self.hostname = hostname
self.username = username
self.password = password
self.port = port
self.hostname = hostname if hostname else config.SFTP_HOST
self.username = username if username else config.SFTP_USER
self.password = password if password else config.SFTP_PASSWORD
self.port = port if port else config.SFTP_PORT
self.connection = None
self.is_connected = False

def connect(self):
Expand Down