
{Udc           @   s{   d  d l  m Z m Z d  d l m Z d  d l m Z e rU d  d l m Z m	 Z	 n  i d d 6Z
 d   Z e d  Z d	 S(
   i(   t   CONTENT_CHUNK_SIZEt   Response(   t   NetworkConnectionError(   t   MYPY_CHECK_RUNNING(   t   Dictt   Iteratort   identitys   Accept-Encodingc         C   s   d } t  |  j t  rW y |  j j d  } Wq` t k
 rS |  j j d  } q` Xn	 |  j } d |  j k oz d k  n r d |  j | |  j f } n; d |  j k o d k  n r d |  j | |  j f } n  | r t | d	 |   n  d  S(
   Nu    s   utf-8s
   iso-8859-1i  i  u   %s Client Error: %s for url: %siX  u   %s Server Error: %s for url: %st   response(   t
   isinstancet   reasont   bytest   decodet   UnicodeDecodeErrort   status_codet   urlR   (   t   respt   http_error_msgR	   (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/utils.pyt   raise_for_status   s    	c         c   sr   y, x% |  j  j | d t D] } | Vq WWn? t k
 rm x/ t ri |  j  j |  } | sa Pn  | Vq? Wn Xd S(   s8   Given a requests Response, provide the data chunks.
    t   decode_contentN(   t   rawt   streamt   Falset   AttributeErrort   Truet   read(   R   t
   chunk_sizet   chunk(    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/utils.pyt   response_chunks:   s    	N(   t   pip._vendor.requests.modelsR    R   t   pip._internal.exceptionsR   t   pip._internal.utils.typingR   t   typingR   R   t   HEADERSR   R   (    (    (    si   /var/www/html/phendo-backend/phendo_python/env/lib/python2.7/site-packages/pip/_internal/network/utils.pyt   <module>   s   	