连接到公司代理后面的公共FTP

时间:2017-12-12 20:49:07

标签: python ftp

我正在尝试在我的工作中访问公共FTP,但我收到了错误。

这就是我在家中使用的代码。

from ftplib import FTP

ftp = FTP('ftp.cetip.com.br')
ftp.login()
ftp.cwd('/MediaCDI')
ftp.quit()

它在我家工作正常,但在我的工作中我收到了这个错误:

Traceback (most recent call last):
  File "C:\Users\TBMEPYG\Desktop\stack.py", line 3, in <module>
    ftp = FTP('ftp.cetip.com.br')
  File "C:\Users\TBMEPYG\AppData\Local\Continuum\Anaconda3\lib\ftplib.py", line 117, in __init__
    self.connect(host)
  File "C:\Users\TBMEPYG\AppData\Local\Continuum\Anaconda3\lib\ftplib.py", line 152, in connect
    source_address=self.source_address)
  File "C:\Users\TBMEPYG\AppData\Local\Continuum\Anaconda3\lib\socket.py", line 722, in create_connection
    raise err
  File "C:\Users\TBMEPYG\AppData\Local\Continuum\Anaconda3\lib\socket.py", line 713, in create_connection
    sock.connect(sa)

[Finished in 21.3s]

当我在HTTP网站上开发一个剪贴板时,我使用HTTPProxyAuth和请求解决了http的问题。只是为了说明,那就是代码:

from requests.auth import HTTPProxyAuth
import requests

user = 'xxxx'
password = 'yyyy'

credenciais = HTTPProxyAuth(user, password)
params = {'Dt_Ref': data, 'TpInstFinanceiro': 'CRI', 'Tipo':'1','saida':'txt'}
proxy_access = {'http':'proxy.mywork/accelerated_pac_base.pac'}
url = 'http://www.anbima.com.br/reune/reune_down.asp'


r = requests.post(url, data = params, proxies = proxy_access , auth = credenciais)

任何人都知道我该怎么做?

由于

0 个答案:

没有答案