Wed, 01 Jan 2014 14:38:45 +0100
Updated copyright for 2014.
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
3160
209a07d7e401
Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3035
diff
changeset
|
3 | # Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
7 | Module implementing an extension to the Python FTP class to support FTP |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
8 | proxies. |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import ftplib |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | from socket import _GLOBAL_DEFAULT_TIMEOUT |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | class E5FtpProxyError(ftplib.Error): |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | Class to signal an error related to proxy configuration. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | The error message starts with a three digit error code followed by a |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | space and the error string. Supported error codes are: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | <ul> |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
22 | <li>910: proxy error; the second number gives the category of the proxy |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
23 | error. The original response from the proxy is appended in the next |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
24 | line.</li> |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
25 | <li>930: proxy error; the second number gives the category of the proxy |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
26 | error. The original response from the proxy is appended in the next |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
27 | line.</li> |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
28 | <li>940: proxy error; the second number gives the category of the proxy |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
29 | error. The original response from the proxy is appended in the next |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
30 | line.</li> |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
31 | <li>950: proxy error; the second number gives the category of the proxy |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
32 | error. The original response from the proxy is appended in the next |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
33 | line.</li> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | <li>990: proxy usage is enabled but no proxy host given</li> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | <li>991: proxy usage is enabled but no proxy user given</li> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | <li>992: proxy usage is enabled but no proxy password given</li> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | </ul> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | class E5FtpProxyType(object): |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | Class defining the supported FTP proxy types. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | NoProxy = 0 # no proxy |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | NonAuthorizing = 1 # non authorizing proxy |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | UserAtServer = 2 # proxy login first, than user@remote.host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | Site = 3 # proxy login first, than use SITE command |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | Open = 4 # proxy login first, than use OPEN command |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | UserAtProxyuserAtServer = 5 # one login for both |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | ProxyuserAtServer = 6 # proxy login with remote host given, than |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | # normal remote login |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
54 | AuthResp = 7 # authenticate to proxy with AUTH and |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
55 | # RESP commands |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | Bluecoat = 8 # bluecoat proxy |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | class E5Ftp(ftplib.FTP): |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | """ |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
61 | Class implementing an extension to the Python FTP class to support FTP |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
62 | proxies. |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | def __init__(self, host="", user="", password="", acct="", |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
65 | proxyType=E5FtpProxyType.NoProxy, proxyHost="", |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
66 | proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
67 | proxyAccount="", timeout=_GLOBAL_DEFAULT_TIMEOUT): |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | Constructor |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | @param host name of the FTP host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | @param user user name for login to FTP host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | @param password password for login to FTP host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | @param acct account for login to FTP host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | @param proxyType type of the FTP proxy (integer 0 to 8) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | @param proxyHost name of the FTP proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | @param proxyPort port of the FTP proxy (integer) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | @param proxyUser user name for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | @param proxyPassword password for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | @param proxyAccount accounting info for the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | @param timeout timeout in seconds for blocking operations (integer) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | """ |
2872
13f12f81cb7b
Fixed the forgotten call to the parent class constructur in the E5Ftp class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
83 | super().__init__() |
13f12f81cb7b
Fixed the forgotten call to the parent class constructur in the E5Ftp class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
84 | |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__timeout = timeout |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.__proxyType = proxyType |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | self.__proxyHost = proxyHost |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.__proxyPort = proxyPort |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | self.__proxyUser = proxyUser |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | self.__proxyPassword = proxyPassword |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | self.__proxyAccount = proxyAccount |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.__host = host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | self.__port = ftplib.FTP_PORT |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | self.__user = user |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.__password = password |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | self.__acct = acct |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | if host: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | self.connect(host) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | if user: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | self.login(user, password, acct) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | def setProxy(self, proxyType=E5FtpProxyType.NoProxy, proxyHost="", |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
106 | proxyPort=ftplib.FTP_PORT, proxyUser="", proxyPassword="", |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
107 | proxyAccount=""): |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | Public method to set the proxy configuration. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | @param proxyType type of the FTP proxy (integer 0 to 8) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | @param proxyHost name of the FTP proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | @param proxyPort port of the FTP proxy (integer) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | @param proxyUser user name for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | @param proxyPassword password for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | @param proxyAccount accounting info for the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | self.__proxyType = proxyType |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.__proxyHost = proxyHost |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.__proxyPort = proxyPort |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | self.__proxyUser = proxyUser |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | self.__proxyPassword = proxyPassword |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.__proxyAccount = proxyAccount |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
125 | def setProxyAuthentication(self, proxyUser="", proxyPassword="", |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
126 | proxyAccount=""): |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | Public method to set the proxy authentication info. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | @param proxyUser user name for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | @param proxyPassword password for login to the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | @param proxyAccount accounting info for the proxy (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | self.__proxyUser = proxyUser |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self.__proxyPassword = proxyPassword |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | self.__proxyAccount = proxyAccount |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | def connect(self, host="", port=0, timeout=-999): |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | Public method to connect to the given FTP server. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | This extended method connects to the proxy instead of the given host, |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | if a proxy is to be used. It throws an exception, if the proxy data |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | is incomplete. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | @param host name of the FTP host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | @param port port of the FTP host (integer) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | @param timeout timeout in seconds for blocking operations (integer) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | @return welcome message of the server (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | @exception E5FtpProxyError raised to indicate a proxy related issue |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | if host: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | self.__host = host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | if port: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | self.__port = port |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | if timeout != -999: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | self.__timeout = timeout |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | if self.__proxyType != E5FtpProxyType.NoProxy: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | if not self.__proxyHost: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | raise E5FtpProxyError( |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | "990 Proxy usage requested, but no proxy host given.") |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
164 | return super().connect( |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
165 | self.__proxyHost, self.__proxyPort, self.__timeout) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | else: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | return super().connect(self.__host, self.__port, self.__timeout) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | def login(self, user="", password="", acct=""): |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | Public method to login to the FTP server. |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
173 | This extended method respects the FTP proxy configuration. There are |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
174 | many different FTP proxy products available. But unfortunately there |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
175 | is no standard for how o traverse a FTP proxy. The lis below shows |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
176 | the sequence of commands used. |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | <table> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | <tr><td>user</td><td>Username for remote host</td></tr> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | <tr><td>pass</td><td>Password for remote host</td></tr> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | <tr><td>pruser</td><td>Username for FTP proxy</td></tr> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | <tr><td>prpass</td><td>Password for FTP proxy</td></tr> |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
183 | <tr><td>remote.host</td><td>Hostname of the remote FTP server</td> |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
184 | </tr> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | </table> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | <dl> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
188 | <dt>E5FtpProxyType.NoProxy:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | USER user<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
193 | <dt>E5FtpProxyType.NonAuthorizing:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | USER user@remote.host<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
198 | <dt>E5FtpProxyType.UserAtServer:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | USER pruser<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | PASS prpass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | USER user@remote.host<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
205 | <dt>E5FtpProxyType.Site:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | USER pruser<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | PASS prpass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | SITE remote.site<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | USER user<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
213 | <dt>E5FtpProxyType.Open:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | USER pruser<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | PASS prpass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | OPEN remote.site<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | USER user<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
221 | <dt>E5FtpProxyType.UserAtProxyuserAtServer:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | USER user@pruser@remote.host<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | PASS pass@prpass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
226 | <dt>E5FtpProxyType.ProxyuserAtServer:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | USER pruser@remote.host<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | PASS prpass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | USER user<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | PASS pass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
233 | <dt>E5FtpProxyType.AuthResp:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | USER user@remote.host<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | PASS pass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | AUTH pruser<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | RESP prpass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | </dd> |
2077
68a34718a0ce
Made the first set of Qt5 compatibility changes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2074
diff
changeset
|
240 | <dt>E5FtpProxyType.Bluecoat:</dt> |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | <dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | USER user@remote.host pruser<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | PASS pass<br/> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | ACCT prpass |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | </dd> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | </dl> |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | @param user username for the remote host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | @param password password for the remote host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | @param acct accounting information for the remote host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | @return response sent by the remote host (string) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | @exception E5FtpProxyError raised to indicate a proxy related issue |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | """ |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | if not user: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | user = "anonymous" |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | if not password: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
257 | # make sure it is a string |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | password = "" |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | if not acct: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | # make sure it is a string |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | acct = "" |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | if user == "anonymous" and password in {'', '-'}: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | password += "anonymous@" |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | if self.__proxyType != E5FtpProxyType.NoProxy: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | if self.__proxyType != E5FtpProxyType.NonAuthorizing: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | # check, if a valid proxy configuration is known |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
268 | if not self.__proxyUser: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
269 | raise E5FtpProxyError( |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | "991 Proxy usage requested, but no proxy user given") |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | if not self.__proxyPassword: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | raise E5FtpProxyError( |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
273 | "992 Proxy usage requested, but no proxy password" |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
274 | " given") |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | if self.__proxyType in [E5FtpProxyType.NonAuthorizing, |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2990
diff
changeset
|
277 | E5FtpProxyType.AuthResp, |
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2990
diff
changeset
|
278 | E5FtpProxyType.Bluecoat]: |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | user += "@" + self.__host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | if self.__proxyType == E5FtpProxyType.Bluecoat: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | user += " " + self.__proxyUser |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | acct = self.__proxyPassword |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | elif self.__proxyType == E5FtpProxyType.UserAtProxyuserAtServer: |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
284 | user = "{0}@{1}@{2}".format( |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
285 | user, self.__proxyUser, self.__host) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | password = "{0}@{1}".format(password, self.__proxyPassword) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | else: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | pruser = self.__proxyUser |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | if self.__proxyType == E5FtpProxyType.UserAtServer: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | user += "@" + self.__host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | elif self.__proxyType == E5FtpProxyType.ProxyuserAtServer: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | pruser += "@" + self.__host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | # authenticate to the proxy first |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | presp = self.sendcmd("USER " + pruser) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | if presp[0] == "3": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | presp = self.sendcmd("PASS " + self.__proxyPassword) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | if presp[0] == "3" and self.__proxyAccount: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | presp = self.sendcmd("ACCT " + self.__proxyAccount) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | if presp[0] != "2": |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
301 | raise E5FtpProxyError( |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
302 | "9{0}0 Error authorizing at proxy\n{1}".format( |
3035
36e9f388958b
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3022
diff
changeset
|
303 | presp[0], presp)) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | if self.__proxyType == E5FtpProxyType.Site: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | # send SITE command |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | presp = self.sendcmd("SITE " + self.__host) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | if presp[0] != "2": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | raise E5FtpProxyError( |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | "9{0}0 Error sending SITE command\n{1}".format( |
3035
36e9f388958b
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3022
diff
changeset
|
311 | presp[0], presp)) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | elif self.__proxyType == E5FtpProxyType.Open: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | # send OPEN command |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
314 | presp = self.sendcmd("OPEN " + self.__host) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | if presp[0] != "2": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | raise E5FtpProxyError( |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | "9{0}0 Error sending OPEN command\n{1}".format( |
3035
36e9f388958b
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3022
diff
changeset
|
318 | presp[0], presp)) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | # authenticate to the remote host or combined to proxy and remote host |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | resp = self.sendcmd("USER " + user) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | if resp[0] == "3": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | resp = self.sendcmd("PASS " + password) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | if resp[0] == "3": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | resp = self.sendcmd("ACCT " + acct) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | if resp[0] != "2": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | raise ftplib.error_reply(resp) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | if self.__proxyType == E5FtpProxyType.AuthResp: |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | # authorize to the FTP proxy |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | presp = self.sendcmd("AUTH " + self.__proxyUser) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | if presp[0] == "3": |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | presp = self.sendcmd("RESP " + self.__proxyPassword) |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | if presp[0] != "2": |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
335 | raise E5FtpProxyError( |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2872
diff
changeset
|
336 | "9{0}0 Error authorizing at proxy\n{1}".format( |
3035
36e9f388958b
Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3022
diff
changeset
|
337 | presp[0], presp)) |
2074
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | |
5cb87968aad5
Reworked the FTP stuff to support a bunch of different FTP proxy types. Unfortunately FTP proxy support is not standardized.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | return resp |