AlkantarClanX12

Your IP : 3.144.48.72


Current Path : /usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/
Upload File :
Current File : //usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyo

�
��abc@@s�dZddlmZyddlZWn@ek
rhddlZddlmZejde��nXddl	m
ZmZ
ddlmZmZdd	lmZmZdd
lmZmZddlmZddlmZyddlZWnek
r
dZnXd
efd��YZdeefd��YZdefd��YZdefd��YZdefd��YZ dS(s�
This module contains provisional support for SOCKS proxies from within
urllib3. This module supports SOCKS4 (specifically the SOCKS4A variant) and
SOCKS5. To enable its functionality, either install PySocks or install this
module with the ``socks`` extra.

The SOCKS implementation supports the full range of urllib3 features. It also
supports the following SOCKS features:

- SOCKS4
- SOCKS4a
- SOCKS5
- Usernames and passwords for the SOCKS proxy

Known Limitations:

- Currently PySocks does not support contacting remote websites via literal
  IPv6 addresses. Any such connection attempt will fail. You must use a domain
  name.
- Currently PySocks does not support IPv6 connections to the SOCKS proxy. Any
  such connection attempt will fail.
i(tabsolute_importNi(tDependencyWarnings�SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.  For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies(terrorttimeout(tHTTPConnectiontHTTPSConnection(tHTTPConnectionPooltHTTPSConnectionPool(tConnectTimeoutErrortNewConnectionError(tPoolManager(t	parse_urltSOCKSConnectioncB@s eZdZd�Zd�ZRS(sG
    A plain-text HTTP connection that connects via a SOCKS proxy.
    cO@s/|jd�|_tt|�j||�dS(Nt_socks_options(tpopR
tsuperRt__init__(tselftargstkwargs((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR?scC@s�i}|jr|j|d<n|jr8|j|d<nyytj|j|jfd|jdd|jdd|jdd|jd	d
|jdd|jd
d|j|�}Wn�tk
r�}t	|d|j|jf��n�tj
k
rf}|jrP|j}t|t�r:t	|d|j|jf��qct
|d|��q�t
|d|��n&tk
r�}t
|d|��nX|S(sA
        Establish a new connection via the SOCKS proxy.
        tsource_addresstsocket_optionst
proxy_typet
socks_versiont
proxy_addrt
proxy_hostt
proxy_porttproxy_usernametusernametproxy_passwordtpasswordt
proxy_rdnstrdnsRs0Connection to %s timed out. (connect timeout=%s)s(Failed to establish a new connection: %s(RRtsockstcreate_connectionthosttportR
Rt
SocketTimeoutRt
ProxyErrort
socket_errt
isinstanceR	tSocketError(Rtextra_kwtconnteR((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyt	_new_connCsL		






		(t__name__t
__module__t__doc__RR-(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR;s	tSOCKSHTTPSConnectioncB@seZRS((R.R/(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR1�stSOCKSHTTPConnectionPoolcB@seZeZRS((R.R/Rt
ConnectionCls(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR2�stSOCKSHTTPSConnectionPoolcB@seZeZRS((R.R/R1R3(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR4�stSOCKSProxyManagercB@s7eZdZied6ed6Zddddd�ZRS(sh
    A version of the urllib3 ProxyManager that routes connections via the
    defined SOCKS proxy.
    thttpthttpsi
cK@st|�}|jdkr-tj}t}	ns|jdkrNtj}t}	nR|jdkrotj}t}	n1|jdkr�tj}t}	ntd|��||_i|d6|j	d6|j
d6|d	6|d
6|	d6}
|
|d<tt|�j
|||�tj|_dS(
Ntsocks5tsocks5htsocks4tsocks4as)Unable to determine SOCKS version from %sRRRRRR R
(RtschemeR!tPROXY_TYPE_SOCKS5tFalsetTruetPROXY_TYPE_SOCKS4t
ValueErrort	proxy_urlR#R$RR5Rtpool_classes_by_scheme(RRBRRt	num_poolstheaderstconnection_pool_kwtparsedRR t
socks_options((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR�s6								
	




N(R.R/R0R2R4RCtNoneR(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyR5�s
(!R0t
__future__RR!tImportErrortwarningst
exceptionsRtwarntsocketRR)RR%t
connectionRRtconnectionpoolRRRR	tpoolmanagerR
tutil.urlRtsslRIRR1R2R4R5(((sE/usr/lib/python2.7/site-packages/pip/_vendor/urllib3/contrib/socks.pyt<module>s2


F