ó
^\kdc           @   s·  d  d l  Z  d  d l  m Z y d  d l m Z m Z Wn' e k
 r_ d  d l m Z m Z n Xd e	 f d „  ƒ  YZ
 ys d Z e
 Z d e f d „  ƒ  YZ y d  d l m Z Wn! e k
 rÒ d  d l m Z n Xd  d l Z e j Z Wn e e f k
 rn Xd	 d
 l m Z d	 d l m Z d	 d l m Z m Z m Z m Z i d d 6d d 6Z d e e	 f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e r³e Z e Z n  d S(   iÿÿÿÿN(   t   timeout(   t   HTTPConnectiont   HTTPExceptiont   DummyConnectionc           B   s   e  Z d  Z RS(   s-   Used to detect a failed ConnectionCls import.(   t   __name__t
   __module__t   __doc__(    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR      s   t   BaseSSLErrorc           B   s   e  Z RS(    (   R   R   (    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR      s   (   t   HTTPSConnectioni   (   t   ConnectTimeoutError(   t   match_hostname(   t   assert_fingerprintt   resolve_cert_reqst   resolve_ssl_versiont   ssl_wrap_socketiP   t   httpi»  t   httpsR   c           B   s3   e  Z e d  Z d Z d „  Z d „  Z d „  Z RS(   R   i   c         C   s€   y+ t  j |  j |  j f |  j |  j ƒ } Wn2 t k
 r_ t  j |  j |  j f |  j ƒ } n X| j t  j t  j	 |  j
 ƒ | S(   sp    Establish a socket connection and set nodelay settings on it

        :return: a new socket connection
        (   t   sockett   create_connectiont   hostt   portR    t   source_addresst   AttributeErrort
   setsockoptt   IPPROTO_TCPt   TCP_NODELAYt   tcp_nodelay(   t   selft   conn(    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyt	   _new_conn=   s    
c         C   s#   | |  _  |  j r |  j ƒ  n  d  S(   N(   t   sockt   _tunnel_hostt   _tunnel(   R   R   (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyt   _prepare_connQ   s    		c         C   s   |  j  ƒ  } |  j | ƒ d  S(   N(   R   R!   (   R   R   (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyt   connectW   s    (   R   R   t   port_by_schemet   default_portR   R   R!   R"   (    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR   7   s
   
		R   c           B   s9   e  Z e d  Z d d d d e j d d „ Z d „  Z RS(   R   c         C   sc   y  t  j |  | | | | | ƒ Wn* t k
 rL t  j |  | | | | ƒ n X| |  _ | |  _ d  S(   N(   R   t   __init__t	   TypeErrort   key_filet	   cert_file(   R   R   R   R'   R(   t   strictR    R   (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR%   _   s     	c         C   s;   |  j  ƒ  } |  j | ƒ t j | |  j |  j ƒ |  _ d  S(   N(   R   R!   t   sslt   wrap_socketR'   R(   R   (   R   R   (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR"   i   s    N(	   R   R   R#   R$   t   NoneR   t   _GLOBAL_DEFAULT_TIMEOUTR%   R"   (    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR   \   s
   
		t   VerifiedHTTPSConnectionc           B   sD   e  Z d  Z d Z d Z d Z d d d d d d d „ Z d „  Z RS(   s[   
    Based on httplib.HTTPSConnection but wraps the socket with
    SSL certification.
    c         C   s:   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   R'   R(   t	   cert_reqst   ca_certst   assert_hostnameR   (   R   R'   R(   R/   R0   R1   R   (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyt   set_certx   s    					c         C   sz  y+ t  j d |  j |  j f d |  j ƒ } Wn0 t k
 r] t |  d |  j |  j f ƒ ‚ n X| j t  j t  j	 |  j
 ƒ t |  j ƒ } t |  j ƒ } t |  d d  ƒ rÉ | |  _ |  j ƒ  |  j } n	 |  j } t | |  j |  j d | d |  j d | d | ƒ|  _ | t j k rv|  j rBt |  j j d	 t ƒ |  j ƒ qv|  j t k	 rvt |  j j ƒ  |  j pl| ƒ qvn  d  S(
   Nt   addressR    s0   Connection to %s timed out. (connect timeout=%s)R   R/   R0   t   server_hostnamet   ssl_versiont   binary_form(    R   R   R   R   R    t   SocketTimeoutR	   R   R   R   R   R   R/   R   R5   t   getattrR,   R   R    R   R   R'   R(   R0   R*   t	   CERT_NONER   t   getpeercertt   TrueR1   t   FalseR
   (   R   R   t   resolved_cert_reqst   resolved_ssl_versiont   actual_host(    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR"   ƒ   s:    	
	
			N(	   R   R   R   R,   R/   R0   R5   R2   R"   (    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyR.   o   s   	(   R   R    R7   t   http.clientR   t   _HTTPConnectionR   t   ImportErrort   httplibt   objectR   R,   R*   R   t   BaseExceptionR   t   _HTTPSConnectiont   SSLErrorR   t
   exceptionsR	   t   packages.ssl_match_hostnameR
   t   utilR   R   R   R   R#   R.   t   UnverifiedHTTPSConnection(    (    (    sW   /var/www/testScraper/venv/build/pip/pip/_vendor/requests/packages/urllib3/connection.pyt   <module>   s<   "
%E