How to replace a non routable IP address with server address on ftplib

后端 未结 1 1388
你的背包
你的背包 2021-01-26 07:47

I\'m trying to use ftplib.FTP_TLS, but I can\'t list the directories.

Everything is OK with Filezilla, but when I\'m on iPython, it fails.

import ftplib
         


        
相关标签:
1条回答
  • 2021-01-26 08:42

    Suppose you know where to connect to. I think the key may be in this line 326:

    325         if self.passiveserver:
    326             host, port = self.makepasv()
    --> 327             conn = socket.create_connection((host, port), self.timeout)
    328             try:
    329                 if rest is not None:
    

    You can subclass and replace the makepasv() method and return the right address. Maybe you can use the output of filezilla or wireshark to get to know the right address.

    0 讨论(0)
提交回复
热议问题