1414# KIND, either express or implied. See the License for the
1515# specific language governing permissions and limitations
1616# under the License.
17+
1718"""The Proxy implementation."""
1819
20+ import warnings
21+
1922
2023class ProxyTypeFactory :
2124 """Factory for proxy types."""
@@ -28,8 +31,8 @@ def make(ff_value, string):
2831class ProxyType :
2932 """Set of possible types of proxy.
3033
31- Each proxy type has 2 properties: 'ff_value' is value of Firefox
32- profile preference, 'string' is id of proxy type.
34+ Each proxy type has 2 properties: 'ff_value' is value of Firefox
35+ profile preference, 'string' is id of proxy type.
3336 """
3437
3538 DIRECT = ProxyTypeFactory .make (0 , "DIRECT" ) # Direct connection, no proxy (default on Windows).
@@ -63,6 +66,14 @@ def __get__(self, obj, cls):
6366 def __set__ (self , obj , value ):
6467 if self .name == "autodetect" and not isinstance (value , bool ):
6568 raise ValueError ("Autodetect proxy value needs to be a boolean" )
69+ if self .name == "ftpProxy" :
70+ # TODO: Remove ftpProxy in future version and remove deprecation warning
71+ # https://github.com/SeleniumHQ/selenium/issues/15905
72+ warnings .warn (
73+ "ftpProxy is deprecated and will be removed in the future" ,
74+ DeprecationWarning ,
75+ stacklevel = 2 ,
76+ )
6677 getattr (obj , "_verify_proxy_type_compatibility" )(self .p_type )
6778 setattr (obj , "proxyType" , self .p_type )
6879 setattr (obj , self .name , value )
@@ -74,7 +85,7 @@ class Proxy:
7485
7586 proxyType = ProxyType .UNSPECIFIED
7687 autodetect = False
77- ftpProxy = ""
88+ ftpProxy = "" # TODO: Remove ftpProxy in future version and remove deprecation warning
7889 httpProxy = ""
7990 noProxy = ""
8091 proxyAutoconfigUrl = ""
@@ -100,6 +111,7 @@ class Proxy:
100111 `value`: `str`
101112 """
102113
114+ # TODO: Remove ftpProxy in future version and remove deprecation warning
103115 ftp_proxy = _ProxyTypeDescriptor ("ftpProxy" , ProxyType .MANUAL )
104116 """Gets and Sets `ftp_proxy`
105117
@@ -244,7 +256,14 @@ def __init__(self, raw=None):
244256 if raw :
245257 if "proxyType" in raw and raw ["proxyType" ]:
246258 self .proxy_type = ProxyType .load (raw ["proxyType" ])
259+ # TODO: Remove ftpProxy in future version and remove deprecation warning
260+ # https://github.com/SeleniumHQ/selenium/issues/15905
247261 if "ftpProxy" in raw and raw ["ftpProxy" ]:
262+ warnings .warn (
263+ "ftpProxy is deprecated and will be removed in the future" ,
264+ DeprecationWarning ,
265+ stacklevel = 2 ,
266+ )
248267 self .ftp_proxy = raw ["ftpProxy" ]
249268 if "httpProxy" in raw and raw ["httpProxy" ]:
250269 self .http_proxy = raw ["httpProxy" ]
@@ -288,6 +307,7 @@ def _verify_proxy_type_compatibility(self, compatible_proxy):
288307
289308 def to_capabilities (self ):
290309 proxy_caps = {"proxyType" : self .proxyType ["string" ].lower ()}
310+ # TODO: Remove ftpProxy in future version and remove deprecation warning
291311 proxies = [
292312 "autodetect" ,
293313 "ftpProxy" ,
0 commit comments