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()
Metadata
Release files for topftp 2024.3.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| topftp-2024.3.13-py3-none-any.whl | Python 3 | none | any | Details |
Release files / topftp-2024.3.13-py3-none-any.whl
| Download URL | topftp-2024.3.13-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3c6e87fa6f1877081a2b18b49d448c0c14f51ae9147ec10ccfddd8266660563
|
|
BLAKE2b-256 checksum How to use checksums |
defcc4ac6f445ef9902b4fc3319e8827375800de7aa009ae90cb986bd0cf6484
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.8
|