Viewing File: /usr/lib/python2.7/site-packages/urllib3/response.pyc
ó
_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' R t _decodert _bodyt _fpt _original_responset _fp_bytes_readt
basestringR t _poolt _connectiont hasattrR&