21 |
21 |
22 def schemeFromProxyType(proxyType): |
22 def schemeFromProxyType(proxyType): |
23 """ |
23 """ |
24 Module function to determine the scheme name from the proxy type. |
24 Module function to determine the scheme name from the proxy type. |
25 |
25 |
26 @param proxyType type of the proxy (QNetworkProxy.ProxyType) |
26 @param proxyType type of the proxy |
27 @return scheme (string, one of Http, Https, Ftp) |
27 @type QNetworkProxy.ProxyType |
|
28 @return schemeone of Http, Https, Ftp) |
|
29 @rtype str |
28 """ |
30 """ |
29 scheme = "" |
31 scheme = "" |
30 if proxyType == QNetworkProxy.ProxyType.HttpProxy: |
32 if proxyType == QNetworkProxy.ProxyType.HttpProxy: |
31 scheme = "Http" |
33 scheme = "Http" |
32 elif proxyType == QNetworkProxy.ProxyType.HttpCachingProxy: |
34 elif proxyType == QNetworkProxy.ProxyType.HttpCachingProxy: |
40 |
42 |
41 def proxyAuthenticationRequired(proxy, auth): |
43 def proxyAuthenticationRequired(proxy, auth): |
42 """ |
44 """ |
43 Module slot to handle a proxy authentication request. |
45 Module slot to handle a proxy authentication request. |
44 |
46 |
45 @param proxy reference to the proxy object (QNetworkProxy) |
47 @param proxy reference to the proxy object |
46 @param auth reference to the authenticator object (QAuthenticator) |
48 @type QNetworkProxy |
|
49 @param auth reference to the authenticator object |
|
50 @type QAuthenticator |
47 """ |
51 """ |
48 from eric7.UI.AuthenticationDialog import AuthenticationDialog |
52 from eric7.UI.AuthenticationDialog import AuthenticationDialog |
49 |
53 |
50 info = QCoreApplication.translate( |
54 info = QCoreApplication.translate( |
51 "EricNetworkProxyFactory", "<b>Connect to proxy '{0}' using:</b>" |
55 "EricNetworkProxyFactory", "<b>Connect to proxy '{0}' using:</b>" |
84 def setPattern(self, pattern): |
88 def setPattern(self, pattern): |
85 """ |
89 """ |
86 Public method to set the match pattern. |
90 Public method to set the match pattern. |
87 |
91 |
88 @param pattern pattern to be matched against |
92 @param pattern pattern to be matched against |
|
93 @type str |
89 """ |
94 """ |
90 self.__pattern = pattern |
95 self.__pattern = pattern |
91 |
96 |
92 if "?" in pattern or "*" in pattern: |
97 if "?" in pattern or "*" in pattern: |
93 regexp = "^.*{0}.*$".format( |
98 regexp = "^.*{0}.*$".format( |
147 |
152 |
148 def queryProxy(self, query): |
153 def queryProxy(self, query): |
149 """ |
154 """ |
150 Public method to determine a proxy for a given query. |
155 Public method to determine a proxy for a given query. |
151 |
156 |
152 @param query reference to the query object (QNetworkProxyQuery) |
157 @param query reference to the query object |
153 @return list of proxies in order of preference (list of QNetworkProxy) |
158 @type QNetworkProxyQuery |
|
159 @return list of proxies in order of preference |
|
160 @rtype list of QNetworkProxy |
154 """ |
161 """ |
155 if ( |
162 if ( |
156 query.queryType() == QNetworkProxyQuery.QueryType.UrlRequest |
163 query.queryType() == QNetworkProxyQuery.QueryType.UrlRequest |
157 and query.protocolTag() in ["http", "https", "ftp"] |
164 and query.protocolTag() in ["http", "https", "ftp"] |
158 ): |
165 ): |