eric7.EricNetwork.EricFtp
Module implementing an extension to the Python FTP class to support FTP
proxies.
Global Attributes
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
EricFtp
Class implementing an extension to the Python FTP class to support FTP
proxies.
Derived from
ftplib.FTP
Class Attributes
Class Methods
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
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.
user | Username for remote host |
pass | Password for remote host |
pruser | Username for FTP proxy |
prpass | Password for FTP proxy |
remote.host | Hostname 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
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:
- 910: proxy error; the second number gives the category of the proxy
error. The original response from the proxy is appended in the next
line.
- 930: proxy error; the second number gives the category of the proxy
error. The original response from the proxy is appended in the next
line.
- 940: proxy error; the second number gives the category of the proxy
error. The original response from the proxy is appended in the next
line.
- 950: proxy error; the second number gives the category of the proxy
error. The original response from the proxy is appended in the next
line.
- 990: proxy usage is enabled but no proxy host given
- 991: proxy usage is enabled but no proxy user given
- 992: proxy usage is enabled but no proxy password given
Derived from
ftplib.Error
Class Attributes
Class Methods
Methods
Static Methods
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
Methods
Static Methods