|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' |
|
3 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'> |
|
4 <html><head> |
|
5 <title>eric5.E5Network.E5Ftp</title> |
|
6 <style> |
|
7 body { |
|
8 background: #EDECE6; |
|
9 margin: 0em 1em 10em 1em; |
|
10 color: black; |
|
11 } |
|
12 |
|
13 h1 { color: white; background: #85774A; } |
|
14 h2 { color: white; background: #85774A; } |
|
15 h3 { color: white; background: #9D936E; } |
|
16 h4 { color: white; background: #9D936E; } |
|
17 |
|
18 a { color: #BA6D36; } |
|
19 |
|
20 </style> |
|
21 </head> |
|
22 <body><a NAME="top" ID="top"></a> |
|
23 <h1>eric5.E5Network.E5Ftp</h1> |
|
24 <p> |
|
25 Module implementing an extension to the Python FTP class to support FTP proxies. |
|
26 </p> |
|
27 <h3>Global Attributes</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 <h3>Classes</h3> |
|
32 <table> |
|
33 <tr> |
|
34 <td><a href="#E5Ftp">E5Ftp</a></td> |
|
35 <td>Class implementing an extension to the Python FTP class to support FTP proxies.</td> |
|
36 </tr><tr> |
|
37 <td><a href="#E5FtpProxyError">E5FtpProxyError</a></td> |
|
38 <td>Class to signal an error related to proxy configuration.</td> |
|
39 </tr><tr> |
|
40 <td><a href="#E5FtpProxyType">E5FtpProxyType</a></td> |
|
41 <td>Class defining the supported FTP proxy types.</td> |
|
42 </tr> |
|
43 </table> |
|
44 <h3>Functions</h3> |
|
45 <table> |
|
46 <tr><td>None</td></tr> |
|
47 </table> |
|
48 <hr /><hr /> |
|
49 <a NAME="E5Ftp" ID="E5Ftp"></a> |
|
50 <h2>E5Ftp</h2> |
|
51 <p> |
|
52 Class implementing an extension to the Python FTP class to support FTP proxies. |
|
53 </p> |
|
54 <h3>Derived from</h3> |
|
55 ftplib.FTP |
|
56 <h3>Class Attributes</h3> |
|
57 <table> |
|
58 <tr><td>None</td></tr> |
|
59 </table> |
|
60 <h3>Class Methods</h3> |
|
61 <table> |
|
62 <tr><td>None</td></tr> |
|
63 </table> |
|
64 <h3>Methods</h3> |
|
65 <table> |
|
66 <tr> |
|
67 <td><a href="#E5Ftp.__init__">E5Ftp</a></td> |
|
68 <td>Constructor</td> |
|
69 </tr><tr> |
|
70 <td><a href="#E5Ftp.connect">connect</a></td> |
|
71 <td>Public method to connect to the given FTP server.</td> |
|
72 </tr><tr> |
|
73 <td><a href="#E5Ftp.login">login</a></td> |
|
74 <td>Public method to login to the FTP server.</td> |
|
75 </tr><tr> |
|
76 <td><a href="#E5Ftp.setProxy">setProxy</a></td> |
|
77 <td>Public method to set the proxy configuration.</td> |
|
78 </tr><tr> |
|
79 <td><a href="#E5Ftp.setProxyAuthentication">setProxyAuthentication</a></td> |
|
80 <td>Public method to set the proxy authentication info.</td> |
|
81 </tr> |
|
82 </table> |
|
83 <h3>Static Methods</h3> |
|
84 <table> |
|
85 <tr><td>None</td></tr> |
|
86 </table> |
|
87 <a NAME="E5Ftp.__init__" ID="E5Ftp.__init__"></a> |
|
88 <h4>E5Ftp (Constructor)</h4> |
|
89 <b>E5Ftp</b>(<i>host="", user="", password="", acct="", proxyType=E5FtpProxyType.NoProxy, proxyHost="", proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", proxyAccount="", timeout=_GLOBAL_DEFAULT_TIMEOUT</i>) |
|
90 <p> |
|
91 Constructor |
|
92 </p><dl> |
|
93 <dt><i>host</i></dt> |
|
94 <dd> |
|
95 name of the FTP host (string) |
|
96 </dd><dt><i>user</i></dt> |
|
97 <dd> |
|
98 user name for login to FTP host (string) |
|
99 </dd><dt><i>password</i></dt> |
|
100 <dd> |
|
101 password for login to FTP host (string) |
|
102 </dd><dt><i>acct</i></dt> |
|
103 <dd> |
|
104 account for login to FTP host (string) |
|
105 </dd><dt><i>proxyType</i></dt> |
|
106 <dd> |
|
107 type of the FTP proxy (integer 0 to 8) |
|
108 </dd><dt><i>proxyHost</i></dt> |
|
109 <dd> |
|
110 name of the FTP proxy (string) |
|
111 </dd><dt><i>proxyPort</i></dt> |
|
112 <dd> |
|
113 port of the FTP proxy (integer) |
|
114 </dd><dt><i>proxyUser</i></dt> |
|
115 <dd> |
|
116 user name for login to the proxy (string) |
|
117 </dd><dt><i>proxyPassword</i></dt> |
|
118 <dd> |
|
119 password for login to the proxy (string) |
|
120 </dd><dt><i>proxyAccount</i></dt> |
|
121 <dd> |
|
122 accounting info for the proxy (string) |
|
123 </dd><dt><i>timeout</i></dt> |
|
124 <dd> |
|
125 timeout in seconds for blocking operations (integer) |
|
126 </dd> |
|
127 </dl><a NAME="E5Ftp.connect" ID="E5Ftp.connect"></a> |
|
128 <h4>E5Ftp.connect</h4> |
|
129 <b>connect</b>(<i>host="", port=0, timeout=-999</i>) |
|
130 <p> |
|
131 Public method to connect to the given FTP server. |
|
132 </p><p> |
|
133 This extended method connects to the proxy instead of the given host, |
|
134 if a proxy is to be used. It throws an exception, if the proxy data |
|
135 is incomplete. |
|
136 </p><dl> |
|
137 <dt><i>host</i></dt> |
|
138 <dd> |
|
139 name of the FTP host (string) |
|
140 </dd><dt><i>port</i></dt> |
|
141 <dd> |
|
142 port of the FTP host (integer) |
|
143 </dd><dt><i>timeout</i></dt> |
|
144 <dd> |
|
145 timeout in seconds for blocking operations (integer) |
|
146 </dd> |
|
147 </dl><dl> |
|
148 <dt>Returns:</dt> |
|
149 <dd> |
|
150 welcome message of the server (string) |
|
151 </dd> |
|
152 </dl><dl> |
|
153 <dt>Raises <b>E5FtpProxyError</b>:</dt> |
|
154 <dd> |
|
155 raised to indicate a proxy related issue |
|
156 </dd> |
|
157 </dl><a NAME="E5Ftp.login" ID="E5Ftp.login"></a> |
|
158 <h4>E5Ftp.login</h4> |
|
159 <b>login</b>(<i>user="", password="", acct=""</i>) |
|
160 <p> |
|
161 Public method to login to the FTP server. |
|
162 </p><p> |
|
163 This extended method respects the FTP proxy configuration. There are many |
|
164 different FTP proxy products available. But unfortunately there is no |
|
165 standard for how o traverse a FTP proxy. The lis below shows the sequence |
|
166 of commands used. |
|
167 </p><p> |
|
168 <table> |
|
169 <tr><td>user</td><td>Username for remote host</td></tr> |
|
170 <tr><td>pass</td><td>Password for remote host</td></tr> |
|
171 <tr><td>pruser</td><td>Username for FTP proxy</td></tr> |
|
172 <tr><td>prpass</td><td>Password for FTP proxy</td></tr> |
|
173 <tr><td>remote.host</td><td>Hostname of the remote FTP server</td></tr> |
|
174 </table> |
|
175 </p><p> |
|
176 <dl> |
|
177 <dt>E5FtpProxyType.NoProxy</dt> |
|
178 <dd> |
|
179 USER user<br/> |
|
180 PASS pass |
|
181 </dd> |
|
182 <dt>E5FtpProxyType.NonAuthorizing</dt> |
|
183 <dd> |
|
184 USER user@remote.host<br/> |
|
185 PASS pass |
|
186 </dd> |
|
187 <dt>E5FtpProxyType.UserAtServer</dt> |
|
188 <dd> |
|
189 USER pruser<br/> |
|
190 PASS prpass<br/> |
|
191 USER user@remote.host<br/> |
|
192 PASS pass |
|
193 </dd> |
|
194 <dt>E5FtpProxyType.Site</dt> |
|
195 <dd> |
|
196 USER pruser<br/> |
|
197 PASS prpass<br/> |
|
198 SITE remote.site<br/> |
|
199 USER user<br/> |
|
200 PASS pass |
|
201 </dd> |
|
202 <dt>E5FtpProxyType.Open</dt> |
|
203 <dd> |
|
204 USER pruser<br/> |
|
205 PASS prpass<br/> |
|
206 OPEN remote.site<br/> |
|
207 USER user<br/> |
|
208 PASS pass |
|
209 </dd> |
|
210 <dt>E5FtpProxyType.UserAtProxyuserAtServer</dt> |
|
211 <dd> |
|
212 USER user@pruser@remote.host<br/> |
|
213 PASS pass@prpass |
|
214 </dd> |
|
215 <dt>E5FtpProxyType.ProxyuserAtServer</dt> |
|
216 <dd> |
|
217 USER pruser@remote.host<br/> |
|
218 PASS prpass<br/> |
|
219 USER user<br/> |
|
220 PASS pass |
|
221 </dd> |
|
222 <dt>E5FtpProxyType.AuthResp</dt> |
|
223 <dd> |
|
224 USER user@remote.host<br/> |
|
225 PASS pass<br/> |
|
226 AUTH pruser<br/> |
|
227 RESP prpass |
|
228 </dd> |
|
229 <dt>E5FtpProxyType.Bluecoat</dt> |
|
230 <dd> |
|
231 USER user@remote.host pruser<br/> |
|
232 PASS pass<br/> |
|
233 ACCT prpass |
|
234 </dd> |
|
235 </dl> |
|
236 </p><dl> |
|
237 <dt><i>user</i></dt> |
|
238 <dd> |
|
239 username for the remote host (string) |
|
240 </dd><dt><i>password</i></dt> |
|
241 <dd> |
|
242 password for the remote host (string) |
|
243 </dd><dt><i>acct</i></dt> |
|
244 <dd> |
|
245 accounting information for the remote host (string) |
|
246 </dd> |
|
247 </dl><dl> |
|
248 <dt>Returns:</dt> |
|
249 <dd> |
|
250 response sent by the remote host (string) |
|
251 </dd> |
|
252 </dl><dl> |
|
253 <dt>Raises <b>E5FtpProxyError</b>:</dt> |
|
254 <dd> |
|
255 raised to indicate a proxy related issue |
|
256 </dd> |
|
257 </dl><a NAME="E5Ftp.setProxy" ID="E5Ftp.setProxy"></a> |
|
258 <h4>E5Ftp.setProxy</h4> |
|
259 <b>setProxy</b>(<i>proxyType=E5FtpProxyType.NoProxy, proxyHost="", proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", proxyAccount=""</i>) |
|
260 <p> |
|
261 Public method to set the proxy configuration. |
|
262 </p><dl> |
|
263 <dt><i>proxyType</i></dt> |
|
264 <dd> |
|
265 type of the FTP proxy (integer 0 to 8) |
|
266 </dd><dt><i>proxyHost</i></dt> |
|
267 <dd> |
|
268 name of the FTP proxy (string) |
|
269 </dd><dt><i>proxyPort</i></dt> |
|
270 <dd> |
|
271 port of the FTP proxy (integer) |
|
272 </dd><dt><i>proxyUser</i></dt> |
|
273 <dd> |
|
274 user name for login to the proxy (string) |
|
275 </dd><dt><i>proxyPassword</i></dt> |
|
276 <dd> |
|
277 password for login to the proxy (string) |
|
278 </dd><dt><i>proxyAccount</i></dt> |
|
279 <dd> |
|
280 accounting info for the proxy (string) |
|
281 </dd> |
|
282 </dl><a NAME="E5Ftp.setProxyAuthentication" ID="E5Ftp.setProxyAuthentication"></a> |
|
283 <h4>E5Ftp.setProxyAuthentication</h4> |
|
284 <b>setProxyAuthentication</b>(<i>proxyUser="", proxyPassword="", proxyAccount=""</i>) |
|
285 <p> |
|
286 Public method to set the proxy authentication info. |
|
287 </p><dl> |
|
288 <dt><i>proxyUser</i></dt> |
|
289 <dd> |
|
290 user name for login to the proxy (string) |
|
291 </dd><dt><i>proxyPassword</i></dt> |
|
292 <dd> |
|
293 password for login to the proxy (string) |
|
294 </dd><dt><i>proxyAccount</i></dt> |
|
295 <dd> |
|
296 accounting info for the proxy (string) |
|
297 </dd> |
|
298 </dl> |
|
299 <div align="right"><a href="#top">Up</a></div> |
|
300 <hr /><hr /> |
|
301 <a NAME="E5FtpProxyError" ID="E5FtpProxyError"></a> |
|
302 <h2>E5FtpProxyError</h2> |
|
303 <p> |
|
304 Class to signal an error related to proxy configuration. |
|
305 </p><p> |
|
306 The error message starts with a three digit error code followed by a |
|
307 space and the error string. Supported error codes are: |
|
308 <ul> |
|
309 <li>910: proxy error; the second number gives the category of the proxy error. |
|
310 The original response from the proxy is appended in the next line.</li> |
|
311 <li>930: proxy error; the second number gives the category of the proxy error. |
|
312 The original response from the proxy is appended in the next line.</li> |
|
313 <li>940: proxy error; the second number gives the category of the proxy error. |
|
314 The original response from the proxy is appended in the next line.</li> |
|
315 <li>950: proxy error; the second number gives the category of the proxy error. |
|
316 The original response from the proxy is appended in the next line.</li> |
|
317 <li>990: proxy usage is enabled but no proxy host given</li> |
|
318 <li>991: proxy usage is enabled but no proxy user given</li> |
|
319 <li>992: proxy usage is enabled but no proxy password given</li> |
|
320 </ul> |
|
321 </p> |
|
322 <h3>Derived from</h3> |
|
323 ftplib.Error |
|
324 <h3>Class Attributes</h3> |
|
325 <table> |
|
326 <tr><td>None</td></tr> |
|
327 </table> |
|
328 <h3>Class Methods</h3> |
|
329 <table> |
|
330 <tr><td>None</td></tr> |
|
331 </table> |
|
332 <h3>Methods</h3> |
|
333 <table> |
|
334 <tr><td>None</td></tr> |
|
335 </table> |
|
336 <h3>Static Methods</h3> |
|
337 <table> |
|
338 <tr><td>None</td></tr> |
|
339 </table> |
|
340 |
|
341 <div align="right"><a href="#top">Up</a></div> |
|
342 <hr /><hr /> |
|
343 <a NAME="E5FtpProxyType" ID="E5FtpProxyType"></a> |
|
344 <h2>E5FtpProxyType</h2> |
|
345 <p> |
|
346 Class defining the supported FTP proxy types. |
|
347 </p> |
|
348 <h3>Derived from</h3> |
|
349 object |
|
350 <h3>Class Attributes</h3> |
|
351 <table> |
|
352 <tr><td>AuthResp</td></tr><tr><td>Bluecoat</td></tr><tr><td>NoProxy</td></tr><tr><td>NonAuthorizing</td></tr><tr><td>Open</td></tr><tr><td>ProxyuserAtServer</td></tr><tr><td>Site</td></tr><tr><td>UserAtProxyuserAtServer</td></tr><tr><td>UserAtServer</td></tr> |
|
353 </table> |
|
354 <h3>Class Methods</h3> |
|
355 <table> |
|
356 <tr><td>None</td></tr> |
|
357 </table> |
|
358 <h3>Methods</h3> |
|
359 <table> |
|
360 <tr><td>None</td></tr> |
|
361 </table> |
|
362 <h3>Static Methods</h3> |
|
363 <table> |
|
364 <tr><td>None</td></tr> |
|
365 </table> |
|
366 |
|
367 <div align="right"><a href="#top">Up</a></div> |
|
368 <hr /> |
|
369 </body></html> |