简体   繁体   English

Python FTPS (FTP_TLS) 连接被拒绝。 没有证书?

[英]Python FTPS (FTP_TLS) connection refused. No certificate?

I would like to download a file over ftps .我想通过ftps下载文件。

When I try to download that file with wget , I have to include the --no-check-certificate for it to work, but I could not find a parallel setting in ftplib .当我尝试使用wget下载该文件时,我必须包含--no-check-certificate才能使其工作,但我在ftplib找不到并行设置。

from ftplib import FTP_TLS

host = "www-i6.informatik.rwth-aachen.de"
file = "/pub/rwth-phoenix/2016/phoenix-2014-T.v3.tar.gz"

ftp = FTP_TLS(host)
ftp.login()

print("size", ftp.size(file))

ftp.retrbinary("RETR " + file, print)

It does print out the size ( size 41699758035 ), but when trying to retrieve the file it gives an error:它确实打印出大小( size 41699758035 ),但是在尝试检索文件时它给出了一个错误:

ConnectionRefusedError: [Errno 111] Connection refused ConnectionRefusedError: [Errno 111] 连接被拒绝

Is it a problem with the certificate?是证书有问题吗? If so, how can I ignore the certificate?如果是这样,我如何忽略证书?


Edit编辑

Using debuglevel=2 , this is the ftp log:使用debuglevel=2 ,这是 ftp 日志:

*cmd* 'AUTH TLS'
*put* 'AUTH TLS\r\n'
*get* '234 AUTH TLS OK.\n'
*resp* '234 AUTH TLS OK.'
*cmd* 'USER anonymous'
*put* 'USER anonymous\r\n'
*get* '230-**************************************************************\n'
*get* '230-***                                                        ***\n'
*get* '230-***          Willkommen auf dem FTP-Server des             ***\n'
*get* '230-***                                                        ***\n'
*get* '230-***          Lehrstuhl fuer Informatik VI der              ***\n'
*get* '230-***                                                        ***\n'
*get* '230-*** Rheinisch-Westfaelischen Technischen Hochschule Aachen *** \n'
*get* '230-***                                                        ***\n'
*get* '230-**************************************************************\n'
*get* '230-\n'
*get* '230 Anonymous user logged in\n'
*resp* '230-**************************************************************\n230-***                                                        ***\n230-***          Willkommen auf dem FTP-Server des             ***\n230-***                                                        ***\n230-***          Lehrstuhl fuer Informatik VI der              ***\n230-***                                                        ***\n230-*** Rheinisch-Westfaelischen Technischen Hochschule Aachen *** \n230-***                                                        ***\n230-**************************************************************\n230-\n230 Anonymous user logged in'
*cmd* 'TYPE I'
*put* 'TYPE I\r\n'
*get* '200 TYPE is now 8-bit binary\n'
*resp* '200 TYPE is now 8-bit binary'
*cmd* 'PASV'
*put* 'PASV\r\n'
*get* '227 Entering Passive Mode (137,226,36,140,182,135)\n'
*resp* '227 Entering Passive Mode (137,226,36,140,182,135)'

ConnectionRefusedError: [Errno 111] Connection refused

Firefall blocked the connection. Firefall 阻止了连接。 No way to solve except changing firewall rules on the end server.除了更改终端服务器上的防火墙规则外,无法解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM