# 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 |
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="")

#### 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:

- 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

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