FTP connection¶
Bases: FileConnection, RenameDirMixin
Based on FTPUtil library.
Warning
Since onETL v0.7.0 to use FTP connector you should install package as follows:
pip install "onetl[ftp]"
# or
pip install "onetl[files]"
Added in 0.1.0
Parameters:
-
host(str) –Host of FTP source. For example:
ftp.domain.com -
port(int, default:21) –Port of FTP source
-
user(str, default:None) –User, which have access to the file source. For example:
someuser.Nonemeans that the user is anonymous. -
password(str, default:None) –Password for file source connection.
Nonemeans that the user is anonymous.
Examples:
Create and check FTP connection:
from onetl.connection import FTP
ftp = FTP(
host="ftp.domain.com",
user="someuser",
password="*****",
).check()
path_exists(path)
¶
Check if specified path exists on remote filesystem. .
Added in 0.8.0
Parameters:
-
path(str | PathLike) –Path to check
Returns:
-
bool–Trueif path exists,Falseotherwise.
Examples:
>>> connection.path_exists("/path/to/file.csv")
True
>>> connection.path_exists("/path/to/dir")
True
>>> connection.path_exists("/path/to/missing")
False