a package on top of ftplib to use FTP easily
Project description
topftp
a package on top of ftplib to use FTP easily
installation
pip install topftp
usage
from topftp.ftp import FTP
host = "127.0.0.1"
user ="username"
password = "password"
port = 21
timeout = 5
ftp = FTP(host, user, password, port=port, timeout=timeout)
# set verbose to True to print exceptions
# set silent to True to not raise exceptions
# ftp.silent = True
# ftp.verbose = True
ftp.connect()
# list files in current directory
files, folders = ftp.listdir()
# download file
ftp.download("/file.txt", "local_file.txt")
# download file content to list
lines = ftp.download_to_list("/file.txt")
# upload file
ftp.upload("local_file.txt", "/remote_file.txt")
# upload from string
ftp.upload_from_string("Hello, topftp!", "/remote_file.txt")
# delete file
ftp.delete("/remote_file.txt")
# for missing methods on ftplib.FTP, you can use them directly
# ftp.some_method(*args, **kwargs)
# is same to
# ftp.ftp.some_method(*args, **kwargs)
# close connection
ftp.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
topftp-2024.2.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for topftp-2024.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63c15334e77fff1cbf3f25e2b60d4ef642fdd283462748d9f4df906b4991f663 |
|
MD5 | 23bbfcc3f916be09a0b16ae8daa94014 |
|
BLAKE2b-256 | f3ef06dc78e8d71254b395bba4d84493a87556bf9e5ac8650c5c93e493953269 |