Current File : //usr/lib/python2.7/site-packages/urllib3/response.pyo |
�
_X�Tc @ s� d d l Z d d l Z d d l m Z d d l m Z d d l m Z m Z m
Z
d d l m Z
m Z m Z d d l m Z m Z d d l m Z d e f d
� � YZ d e f d � � YZ d
� Z d e j f d � � YZ d S( i����N( t timeouti ( t HTTPHeaderDict( t
ProtocolErrort DecodeErrort ReadTimeoutError( t string_typest binary_typet PY3( t
HTTPExceptiont BaseSSLError( t is_fp_closedt DeflateDecoderc B s# e Z d � Z d � Z d � Z RS( c C s( t | _ t � | _ t j � | _ d S( N( t Truet
_first_tryR t _datat zlibt
decompressobjt _obj( t self( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyt __init__ s c C s t | j | � S( N( t getattrR ( R t name( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyt __getattr__ s c C s� | s
| S| j s# | j j | � S| j | 7_ y | j j | � SWnT t j k
r� t | _ t j t j � | _ z | j | j � SWd d | _ Xn Xd S( N(
R
R t
decompressR R t errort FalseR t MAX_WBITSt None( R t data( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR s ( t __name__t
__module__R R R ( ( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR s t GzipDecoderc B s# e Z d � Z d � Z d � Z RS( c C s t j d t j � | _ d S( Ni ( R R R R ( R ( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR + s c C s t | j | � S( N( R R ( R R ( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR . s c C s | s
| S| j j | � S( N( R R ( R R ( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR 1 s ( R R R R R ( ( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyR ) s c C s | d k r t � St � S( Nt gzip( R R ( t mode( ( s4 /usr/lib/python2.7/site-packages/urllib3/response.pyt _get_decoder7 s t HTTPResponsec B s e Z d Z d d g Z d d d d d g Z d d d d d d e e d d d d
� Z d � Z d � Z e
d
� � Z d � Z d d e
d � Z d d d � Z e d � � Z d � Z d d � Z d � Z e
d � � Z d � Z d � Z d � Z d � Z RS( s�
HTTP Response container.
Backwards-compatible to httplib's HTTPResponse but the response ``body`` is
loaded and decoded on-demand when the ``data`` property is accessed. This
class is also compatible with the Python standard library's :mod:`io`
module, and can hence be treated as a readable object in the context of that
framework.
Extra parameters for behaviour not present in httplib.HTTPResponse:
:param preload_content:
If True, the response's body will be preloaded during construction.
:param decode_content:
If True, attempts to decode specific content-encoding's based on headers
(like 'gzip' and 'deflate') will be skipped and raw data will be used
instead.
:param original_response:
When this HTTPResponse wrapper is generated from an httplib.HTTPResponse
object, it's convenient to include the original for debug purposes. It's
otherwise unused.
R t deflatei- i. i/ i3 i4 t i c C s t | t � r | | _ n t | � | _ | | _ | | _ | | _ | | _ | | _ d | _ d | _
d | _ | | _ d | _
| r� t | t t f � r� | | _
n |
| _ | | _ t | d � r� | | _ n | r | j
r | j d | � | _
n d S( Ni t readt decode_content( t
isinstanceR t headerst statust versiont reasont strictR'