-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path_deprecated.py
39 lines (27 loc) · 906 Bytes
/
_deprecated.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import warnings
from .core_socks import (
ProxyError,
ProxyConnectionError,
ProxyType
)
from .connector import ProxyConnector
class SocksVer(object):
SOCKS4 = 1
SOCKS5 = 2
def _warn_about_connector():
warnings.warn('SocksConnector is deprecated. '
'Use ProxyConnector instead.', DeprecationWarning,
stacklevel=3)
class SocksConnector(ProxyConnector):
def __init__(self, socks_ver=SocksVer.SOCKS5, **kwargs):
_warn_about_connector() # noqa
if 'proxy_type' in kwargs: # from_url
super().__init__(**kwargs)
else:
super().__init__(proxy_type=ProxyType(socks_ver), **kwargs)
@classmethod
def from_url(cls, url, **kwargs):
_warn_about_connector() # noqa
return super().from_url(url, **kwargs)
SocksError = ProxyError
SocksConnectionError = ProxyConnectionError