eric7.EricNetwork.EricFtp

Module implementing an extension to the Python FTP class to support FTP proxies.

Global Attributes

None

Classes

EricFtp Class implementing an extension to the Python FTP class to support FTP proxies.
EricFtpProxyError Class to signal an error related to proxy configuration.
EricFtpProxyType Class defining the supported FTP proxy types.

Functions

None


EricFtp

Class implementing an extension to the Python FTP class to support FTP proxies.

Derived from

ftplib.FTP

Class Attributes

None

Class Methods

None

Methods

EricFtp Constructor
connect Public method to connect to the given FTP server.
login Public method to login to the FTP server.
setProxy Public method to set the proxy configuration.
setProxyAuthentication Public method to set the proxy authentication info.

Static Methods

None

EricFtp (Constructor)

EricFtp(host="", user="", password="", acct="", proxyType=EricFtpProxyType.NO_PROXY, proxyHost="", proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", proxyAccount="", timeout=_GLOBAL_DEFAULT_TIMEOUT, )

Constructor

host (str)
name of the FTP host
user (str)
user name for login to FTP host
password (str)
password for login to FTP host
acct (str)
account for login to FTP host
proxyType (EricFtpProxyType)
type of the FTP proxy
proxyHost (str)
name of the FTP proxy
proxyPort (int)
port of the FTP proxy
proxyUser (str)
user name for login to the proxy
proxyPassword (str)
password for login to the proxy
proxyAccount (str)
accounting info for the proxy
timeout (int)
timeout in seconds for blocking operations

EricFtp.connect

connect(host="", port=0, timeout=-999)

Public method to connect to the given FTP server.

This extended method connects to the proxy instead of the given host, if a proxy is to be used. It throws an exception, if the proxy data is incomplete.

host (str)
name of the FTP host
port (int)
port of the FTP host
timeout (int)
timeout in seconds for blocking operations
Return:
welcome message of the server
Return Type:
str
Raises EricFtpProxyError:
raised to indicate a proxy related issue

EricFtp.login

login(user="", password="", acct="")

Public method to login to the FTP server.

This extended method respects the FTP proxy configuration. There are many different FTP proxy products available. But unfortunately there is no standard for how o traverse a FTP proxy. The lis below shows the sequence of commands used.

userUsername for remote host
passPassword for remote host
pruserUsername for FTP proxy
prpassPassword for FTP proxy
remote.hostHostname of the remote FTP server

EricFtpProxyType.NO_PROXY:
USER user
PASS pass
EricFtpProxyType.NON_AUTHORIZING:
USER user@remote.host
PASS pass
EricFtpProxyType.USER_SERVER:
USER pruser
PASS prpass
USER user@remote.host
PASS pass
EricFtpProxyType.SITE:
USER pruser
PASS prpass
SITE remote.site
USER user
PASS pass
EricFtpProxyType.OPEN:
USER pruser
PASS prpass
OPEN remote.site
USER user
PASS pass
EricFtpProxyType.USER_PROXYUSER_SERVER:
USER user@pruser@remote.host
PASS pass@prpass
EricFtpProxyType.PROXYUSER_SERVER:
USER pruser@remote.host
PASS prpass
USER user
PASS pass
EricFtpProxyType.AUTH_RESP:
USER user@remote.host
PASS pass
AUTH pruser
RESP prpass
EricFtpProxyType.BLUECOAT:
USER user@remote.host pruser
PASS pass
ACCT prpass

user (str)
username for the remote host
password (str)
password for the remote host
acct (str)
accounting information for the remote host
Return:
response sent by the remote host
Return Type:
str
Raises EricFtpProxyError:
raised to indicate a proxy related issue
Raises ftplib.error_reply:
raised to indicate an FTP error reply

EricFtp.setProxy

setProxy(proxyType=EricFtpProxyType.NO_PROXY, proxyHost="", proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", proxyAccount="", )

Public method to set the proxy configuration.

proxyType (EricFtpProxyType)
type of the FTP proxy
proxyHost (str)
name of the FTP proxy
proxyPort (int)
port of the FTP proxy
proxyUser (str)
user name for login to the proxy
proxyPassword (str)
password for login to the proxy
proxyAccount (str)
accounting info for the proxy

EricFtp.setProxyAuthentication

setProxyAuthentication(proxyUser="", proxyPassword="", proxyAccount="")

Public method to set the proxy authentication info.

proxyUser (str)
user name for login to the proxy
proxyPassword (str)
password for login to the proxy
proxyAccount (str)
accounting info for the proxy
Up


EricFtpProxyError

Class to signal an error related to proxy configuration.

The error message starts with a three digit error code followed by a space and the error string. Supported error codes are:

Derived from

ftplib.Error

Class Attributes

None

Class Methods

None

Methods

None

Static Methods

None
Up


EricFtpProxyType

Class defining the supported FTP proxy types.

Derived from

enum.Enum

Class Attributes

AUTH_RESP
BLUECOAT
NON_AUTHORIZING
NO_PROXY
OPEN
PROXYUSER_SERVER
SITE
USER_PROXYUSER_SERVER
USER_SERVER

Class Methods

None

Methods

None

Static Methods

None
Up