Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lixxu/topftp
a package on top of ftplib to use ftp easily
https://github.com/lixxu/topftp
Last synced: 26 days ago
JSON representation
a package on top of ftplib to use ftp easily
- Host: GitHub
- URL: https://github.com/lixxu/topftp
- Owner: lixxu
- License: bsd-3-clause
- Created: 2024-02-01T08:23:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-09-13T07:04:06.000Z (3 months ago)
- Last Synced: 2024-11-16T21:36:59.050Z (about 1 month ago)
- Language: Python
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# topftp
a package on top of ftplib to use FTP easily
## installation
```bash
pip install topftp
```## usage
```python
from topftp.ftp import FTPhost = "127.0.0.1"
user ="username"
password = "password"
port = 21
timeout = 5ftp = 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 = Trueftp.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()
```