/opt/alt/python27/lib/python2.7/site-packages/requests
NameSizeModeActions
packages/-0755rm
adapters.py186800644editdlrm
adapters.pyc172040644editdlrm
adapters.pyo172040644editdlrm
api.py57950644editdlrm
api.pyc66330644editdlrm
api.pyo66330644editdlrm
auth.py80750644editdlrm
auth.pyc90770644editdlrm
auth.pyo90770644editdlrm
certs.py6490644editdlrm
certs.pyc9230644editdlrm
certs.pyo9230644editdlrm
compat.py15490644editdlrm
compat.pyc17070644editdlrm
compat.pyo17070644editdlrm
cookies.py175640644editdlrm
cookies.pyc217090644editdlrm
cookies.pyo217090644editdlrm
exceptions.py27760644editdlrm
exceptions.pyc61210644editdlrm
exceptions.pyo61210644editdlrm
hooks.py7670644editdlrm
hooks.pyc12400644editdlrm
hooks.pyo12400644editdlrm
models.py295300644editdlrm
models.pyc264090644editdlrm
models.pyo264090644editdlrm
sessions.py248970644editdlrm
sessions.pyc205480644editdlrm
sessions.pyo205480644editdlrm
status_codes.py33150644editdlrm
status_codes.pyc46290644editdlrm
status_codes.pyo46290644editdlrm
structures.py30170644editdlrm
structures.pyc54450644editdlrm
structures.pyo54450644editdlrm
utils.py222280644editdlrm
utils.pyc216640644editdlrm
utils.pyo216640644editdlrm
__init__.py22150644editdlrm
__init__.pyc28680644editdlrm
__init__.pyo28680644editdlrm
Edit: /opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyc (17204B)
ó &Ú#Wc@s;dZddlZddlZddlmZddlmZmZddl m Z ddl m Z ddlmZdd lmZmZdd lmZmZmZmZmZmZmZdd lmZdd lmZdd lmZddlm Z!ddlm"Z"ddlm#Z#ddlm$Z%ddlm&Z&ddlm'Z'ddlm(Z)ddlm*Z*ddl+m,Z,ddl-m.Z.m/Z/m0Z0m(Z(m$Z$m1Z1m2Z2ddl3m4Z4yddl5m6Z6Wne7k ròd„Z6nXe8Z9dZ:dZ;dZ=de>fd„ƒYZ?de?fd „ƒYZ@dS(!s‰ requests.adapters ~~~~~~~~~~~~~~~~~ This module contains the transport adapters that Requests uses to define and maintain connections. iÿÿÿÿNi(tResponse(t PoolManagertproxy_from_url(t HTTPResponse(tTimeout(tRetry(turlparset basestring(tDEFAULT_CA_BUNDLE_PATHtget_encoding_from_headerstprepend_scheme_if_neededtget_auth_from_urlt urldefragautht select_proxytto_native_string(tCaseInsensitiveDict(tClosedPoolError(tConnectTimeoutError(t HTTPError(t MaxRetryError(tNewConnectionError(t ProxyError(t ProtocolError(tReadTimeoutError(tSSLError(t ResponseError(textract_cookies_to_jar(tConnectionErrortConnectTimeoutt ReadTimeoutRRt RetryErrort InvalidSchema(t_basic_auth_str(tSOCKSProxyManagercOstdƒ‚dS(Ns'Missing dependencies for SOCKS support.(R(targstkwargs((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR!*si it BaseAdaptercBs)eZdZd„Zd„Zd„ZRS(sThe Base Transport AdaptercCstt|ƒjƒdS(N(tsuperR$t__init__(tself((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR&6scCs t‚dS(N(tNotImplementedError(R'((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pytsend9scCs t‚dS(N(R((R'((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pytclose<s(t__name__t __module__t__doc__R&R)R*(((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR$3s  t HTTPAdaptercBs¹eZdZdddddgZeeeed„Zd„Zd„Z ed „Z d „Z d „Z d „Z dd „Zd„Zd„Zd„Zd„Zededdd„ZRS(sThe built-in HTTP Adapter for urllib3. Provides a general-case interface for Requests sessions to contact HTTP and HTTPS urls by implementing the Transport Adapter interface. This class will usually be created by the :class:`Session ` class under the covers. :param pool_connections: The number of urllib3 connection pools to cache. :param pool_maxsize: The maximum number of connections to save in the pool. :param max_retries: The maximum number of retries each connection should attempt. Note, this applies only to failed DNS lookups, socket connections and connection timeouts, never to requests where data has made it to the server. By default, Requests does not retry failed connections. If you need granular control over the conditions under which we retry a request, import urllib3's ``Retry`` class and pass that instead. :param pool_block: Whether the connection pool should block for connections. Usage:: >>> import requests >>> s = requests.Session() >>> a = requests.adapters.HTTPAdapter(max_retries=3) >>> s.mount('http://', a) t max_retriestconfigt_pool_connectionst _pool_maxsizet _pool_blockcCs|tkr$tddtƒ|_ntj|ƒ|_i|_i|_tt|ƒj ƒ||_ ||_ ||_ |j ||d|ƒdS(Nitreadtblock(tDEFAULT_RETRIESRtFalseR/tfrom_intR0t proxy_managerR%R.R&R1R2R3tinit_poolmanager(R'tpool_connectionst pool_maxsizeR/t pool_block((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR&]s      cst‡fd†ˆjDƒƒS(Nc3s'|]}|tˆ|dƒfVqdS(N(tgetattrtNone(t.0tattr(R'(sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pys ps(tdictt __attrs__(R'((R'sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt __getstate__oscCsbi|_i|_x*|jƒD]\}}t|||ƒqW|j|j|jd|jƒdS(NR5(R9R0titemstsetattrR:R1R2R3(R'tstateRAtvalue((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt __setstate__ss   c KsF||_||_||_td|d|d|dt||_dS(sInitializes a urllib3 PoolManager. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param connections: The number of urllib3 connection pools to cache. :param maxsize: The maximum number of connections to save in the pool. :param block: Block when no free connections are available. :param pool_kwargs: Extra keyword arguments used to initialize the Pool Manager. t num_poolstmaxsizeR5tstrictN(R1R2R3RtTruet poolmanager(R't connectionsRKR5t pool_kwargs((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR:s   c KsØ||jkr|j|}nµ|jƒjdƒrŠt|ƒ\}}t|d|d|d|jd|jd|j|}|j|`. :param proxy: The proxy to return a urllib3 ProxyManager for. :param proxy_kwargs: Extra keyword arguments used to configure the Proxy Manager. :returns: ProxyManager tsockstusernametpasswordRJRKR5t proxy_headers( R9tlowert startswithR R!R1R2R3RTR(R'tproxyt proxy_kwargstmanagerRRRSRT((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pytproxy_manager_for“s*     cCsê|jƒjdƒr|rd}|tk r6|}n|sEt}n|sZtdƒ‚nd|_tjj |ƒs||_ q¨||_ nd|_d|_ d|_ |ræt |t ƒsÚ|d|_|d|_qæ||_ndS(s½Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param conn: The urllib3 connection object associated with the cert. :param url: The requested URL. :param verify: Whether we should actually verify the certificate. :param cert: The SSL certificate to verify. thttpss4Could not find a suitable SSL CA certificate bundle.t CERT_REQUIREDt CERT_NONEiiN(RURVR?RMRt Exceptiont cert_reqstostpathtisdirtca_certst ca_cert_dirt isinstanceRt cert_filetkey_file(R'tconnturltverifytcerttcert_loc((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt cert_verify·s(           cCsÂtƒ}t|ddƒ|_tt|diƒƒ|_t|jƒ|_||_|jj |_ t |j t ƒr|j j dƒ|_ n |j |_ t|j||ƒ||_||_|S(s”Builds a :class:`Response ` object from a urllib3 response. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter ` :param req: The :class:`PreparedRequest ` used to generate the response. :param resp: The urllib3 response object. tstatustheaderssutf-8N(RR>R?t status_codeRRoR tencodingtrawtreasonReRitbytestdecodeRtcookiestrequestt connection(R'treqtresptresponse((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pytbuild_responseás     cCsst||ƒ}|rEt|dƒ}|j|ƒ}|j|ƒ}n*t|ƒ}|jƒ}|jj|ƒ}|S(seReturns a urllib3 connection for the given URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param url: The URL to connect to. :param proxies: (optional) A Requests-style dictionary of proxies used on this request. thttp(R R RZtconnection_from_urlRtgeturlRN(R'RitproxiesRWR9Rhtparsed((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pytget_connections  cCs5|jjƒx!|jjƒD]}|jƒqWdS(s¢Disposes of any internal state. Currently, this closes the PoolManager and any active ProxyManager, which closes any pooled connections. N(RNtclearR9tvalues(R'RW((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR*s c Cs•t|j|ƒ}t|jƒj}|o3|dk}t}|rit|ƒjjƒ}|jdƒ}n|j}|r‘| r‘t|jƒ}n|S(s+Obtain the url to use when making the final request. If the message is being sent through a HTTP proxy, the full URL has to be used. Otherwise, we should only use the path portion of the URL. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` being sent. :param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. R[RQ( R RiRtschemeR7RURVtpath_urlR ( R'RwR€RWR…tis_proxied_http_requesttusing_socks_proxyt proxy_schemeRi((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt request_url%s   cKsdS(s"Add any headers needed by the connection. As of v2.0 this does nothing by default, but is left for overriding by users that subclass the :class:`HTTPAdapter `. This should not be called from user code, and is only exposed for use when subclassing the :class:`HTTPAdapter `. :param request: The :class:`PreparedRequest ` to add headers to. :param kwargs: The keyword arguments from the call to send(). N((R'RwR#((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt add_headersAs cCs>i}t|ƒ\}}|r:|r:t||ƒ|d`. :param proxies: The url of the proxy being used for this request. sProxy-Authorization(R R (R'RWRoRRRS((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyRTOs  cCsD|j|j|ƒ}|j||j||ƒ|j||ƒ}|j|ƒ|jdkphd|jk } t|t ƒrÔy%|\} } t d| d| ƒ}Wqét k rÐ} dj |ƒ} t | ƒ‚qéXnt d|d|ƒ}yÇ| sI|j d|jd|d|jd|jd td td td td |jd|ƒ }nft|dƒrd|j}n|jdtƒ}y"|j|j|dtƒx-|jjƒD]\}}|j||ƒq¢W|jƒx^|jD]S}|jtt|ƒƒdjdƒƒ|jdƒ|j|ƒ|jdƒqÖW|jdƒy|jdtƒ}Wntk ro|jƒ}nXt j!|d|d|d td tƒ}Wn|j"ƒ‚nXWnt#t$j%fk rà} t&| d|ƒ‚nTt'k rŽ} t| j(t)ƒr+t| j(t*ƒs+t+| d|ƒ‚q+nt| j(t,ƒrRt-| d|ƒ‚nt| j(t.ƒryt/| d|ƒ‚nt&| d|ƒ‚n¦t0k r²} t&| d|ƒ‚n‚t.k rÐ} t/| ƒ‚ndt1t2fk r3} t| t1ƒr t3| d|ƒ‚q4t| t4ƒr-t5| d|ƒ‚q4‚nX|j6||ƒS(s°Sends PreparedRequest object. Returns Response object. :param request: The :class:`PreparedRequest ` being sent. :param stream: (optional) Whether to stream the request content. :param timeout: (optional) How long to wait for the server to send data before giving up, as a float, or a :ref:`(connect timeout, read timeout) ` tuple. :type timeout: float or tuple :param verify: (optional) Whether to verify SSL certificates. :param cert: (optional) Any user-provided SSL certificate to be trusted. :param proxies: (optional) The proxies dictionary to apply to the request. sContent-LengthtconnectR4ssInvalid timeout {0}. Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same valuetmethodRitbodyRotredirecttassert_same_hosttpreload_contenttdecode_contenttretriesttimeoutt proxy_pooltskip_accept_encodingisutf-8s s0 t bufferingtpoolRxRwN(7R‚RiRmRŠR‹RŽR?RoRettuplet TimeoutSaucet ValueErrortformatturlopenRR7R/thasattrR•t _get_conntDEFAULT_POOL_TIMEOUTt putrequestRMREt putheadert endheadersR)thextlentencodet getresponset TypeErrorRt from_httplibR*RtsocketterrorRRRsRRRRRt _ProxyErrorRRt _SSLErrort _HTTPErrorRRRR|(R'RwtstreamR”RjRkR€RhRitchunkedRŒR4teterrRztlow_conntheaderRHtitr((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR)dsœ            &       N(R+R,R-RCtDEFAULT_POOLSIZER6tDEFAULT_POOLBLOCKR&RDRIR:RZRmR|R?R‚R*RŠR‹RTR7RMR)(((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyR.@s$      $ * $    (AR-tos.pathR`RªtmodelsRtpackages.urllib3.poolmanagerRRtpackages.urllib3.responseRtpackages.urllib3.utilRRštpackages.urllib3.util.retryRtcompatRRtutilsRR R R R R Rt structuresRtpackages.urllib3.exceptionsRRRR®RRRR¬RRRR­RRvRt exceptionsRRRRRtauthR tpackages.urllib3.contrib.socksR!t ImportErrorR7R¸R·R6R?R tobjectR$R.(((sB/opt/alt/python27/lib/python2.7/site-packages/requests/adapters.pyt sB  44