Skip to main content

Download SFTP files using a glob to get all files & also keep a log to keep track of processing

Project description

WalkSFTP

This is project is a class that allows for a glob like sftp download to a temporary file and lets you process the downloaded data using processing_function. The log argument can be used to check if the get and process ran correctly so you can run and not pull files that have already been processed and keeps track of files based on their modified time. This uses threading to separate the glob sftp files and the process function.

Installation

Run the following to install:

pip install walk_sftp

Usage

from walk_sftp import WalkSFTP

def process(f)

	try:
		# if successfull
		return True
	except:
		# if unsuccessfull
		return False

WalkSFTP(
    ftp_web_address,
    username,
    password,
    start_date='2020-12-25', # optional
	end_date='2020-12-28', # optional
    print_out=True, # optional
    processing_function=process, # optional
    log='/some_path_to_log.p', # optional
)

Development walk_sftp

To install walk_sftp, along with the tools you need to develop and run tests, run the following in your virtualend:

$ pip install -e .[dev]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

walk_sftp-0.0.28.tar.gz (12.5 kB view hashes)

Uploaded Source

Built Distribution

walk_sftp-0.0.28-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page