跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.textin.com/llms.txt

Use this file to discover all available pages before exploring further.

FTP 远程文件服务

FTP 数据源用于从 FTP 服务器读取文档,使用 Python 标准库 ftplib 实现。

参数说明

参数类型必填说明
typestring固定为 "ftp"
hoststringFTP 服务器地址(IP 或域名)
portintegerFTP 服务器端口,默认为 21
usernamestringFTP 用户名
passwordstringFTP 密码

如何获取鉴权参数

FTP 连接需要以下信息:
  1. FTP 服务器地址:由 FTP 服务提供商提供,通常是 IP 地址或域名
  2. 端口:FTP 默认端口为 21,FTPS(FTP over SSL)通常使用 990
  3. 用户名和密码:由 FTP 服务管理员提供
常见 FTP 服务
  • 自建 FTP 服务器:需要联系服务器管理员获取连接信息
  • 云服务商 FTP 服务:在云服务商控制台创建 FTP 用户并获取连接信息
  • 企业 FTP 服务器:联系 IT 部门获取访问凭证

配置示例

source = FtpSource(
    host='ftp.example.com',
    port=21,
    username='your-username',
    password='your-password'
)

使用示例

from xparse_client import FtpSource, Pipeline

source = FtpSource(
    host='ftp.example.com',
    port=21,
    username='myuser',
    password='mypassword'
)

# ... 其他配置

pipeline = Pipeline(
    source=source,
    # ...其他配置
)
pipeline.run()

注意事项

  1. 安全性:FTP 协议传输密码时未加密,建议在生产环境中使用 FTPS(FTP over SSL)或 SFTP
  2. 防火墙:确保 FTP 服务器的端口(通常是 21)未被防火墙阻止
  3. 被动模式:如果遇到连接问题,可能需要配置 FTP 客户端使用被动模式(PASV)