/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/sessions.pyc (20548B)
ó ¹Ö#Wc@sÅdZddlZddlmZddlmZddlmZddlmZm Z m Z m Z ddl m Z mZmZmZdd lmZmZmZdd lmZmZdd lmZmZmZdd lmZmZmZm Z dd l!m"Z"ddl#m$Z$ddl%m&Z&ddlm'Z'm(Z(m)Z)m*Z*m+Z+ddl,m-Z-ddlm.Z.dZ/e d„Z0e d„Z1de2fd„ƒYZ3de3fd„ƒYZ4d„Z5dS(s” requests.session ~~~~~~~~~~~~~~~~ This module provides a Session object to manage and persist settings across requests (cookies, auth, proxies). iÿÿÿÿN(tMapping(tdatetimei(t_basic_auth_str(t cookielibt OrderedDictturljointurlparse(tcookiejar_from_dicttextract_cookies_to_jartRequestsCookieJart merge_cookies(tRequesttPreparedRequesttDEFAULT_REDIRECT_LIMIT(t default_hookst dispatch_hook(tto_key_val_listtdefault_headerstto_native_string(tTooManyRedirectst InvalidSchematChunkedEncodingErrortContentDecodingError(tRecentlyUsedContainer(tCaseInsensitiveDict(t HTTPAdapter(t requote_uritget_environ_proxiestget_netrc_authtshould_bypass_proxiestget_auth_from_url(tcodes(tREDIRECT_STATIiècCs´|dkr|S|dkr |St|tƒo;t|tƒsB|S|t|ƒƒ}|jt|ƒƒg|jƒD]\}}|dkrt|^qt}x|D] }||=qŸW|S(sí Determines appropriate setting for a given request, taking into account the explicit setting on that request, and the setting in the session. If a setting is a dictionary, they will be merged together using `dict_class` N(tNonet isinstanceRRtupdatetitems(trequest_settingtsession_settingt dict_classtmerged_settingtktvt none_keystkey((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt merge_setting*s  1  cCsZ|dks!|jdƒgkr%|S|dksF|jdƒgkrJ|St|||ƒS(s® Properly merges both requests and session hooks. This is necessary because when request_hooks == {'response': []}, the merge breaks Session hooks entirely. tresponseN(R!tgetR-(t request_hookst session_hooksR'((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt merge_hooksJs !!tSessionRedirectMixincBs;eZededdd„Zd„Zd„Zd„ZRS(cksÍd} g} xº|jrÈ|jƒ} | dkrU| j|ƒt| ƒ} | |_ny |jWn-tttfk r|j j dt ƒnX| |j kr»t d|j d|ƒ‚n|jƒ|jd} | jdƒrt|jƒ}d|j| f} nt| ƒ}|jƒ} |jsBt|jt| ƒƒ} n t| ƒ} t| ƒ| _|jrŽ|j| jkrŽ| j|j|jRkRRR/t setdefaultRRVR( R]RcR;RIRKRLt new_proxiestenviron_proxiestproxytusernametpassword((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyRZÔs$       cCs‹|j}|jtjkr0|dkr0d}n|jtjkrW|dkrWd}n|jtjkr~|dkr~d}n||_dS(s‚When being redirected we may want to change the method of the request based on certain specs or browser behavior. tHEADtGETtPOSTN(tmethodRRRt see_othertfoundtmoved(R]RcR.Ry((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyRQùs    N( t__name__t __module__RFR!tTrueRgR[RZRQ(((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyR3Zs _  %tSessioncBseZdZddddddddd d d d d g Zd„Zd„Zd„Zd„Zd!d!d!d!d!d!d!e d!d!d!d!d!d!d„Z d„Z d„Z d„Z d!d!d„Zd!d„Zd!d„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd „ZRS("s~A Requests session. Provides cookie persistence, connection-pooling, and configuration. Basic Usage:: >>> import requests >>> s = requests.Session() >>> s.get('http://httpbin.org/get') Or as a context manager:: >>> with requests.Session() as s: >>> s.get('http://httpbin.org/get') RIRXtauthR;thookstparamsR9R:tprefetchtadaptersR7RkRGcCs´tƒ|_d|_i|_tƒ|_i|_t|_ t |_ d|_ t |_t |_tiƒ|_tƒ|_|jdtƒƒ|jdtƒƒttƒ|_dS(Nshttps://shttp://(RRIR!RR;RR‚RƒRFR7RR9R:R RGRkRRXRR…tmountRRtREDIRECT_CACHE_SIZERP(R]((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt__init__)s           cCs|S(N((R]((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt __enter__`scGs|jƒdS(N(RH(R]targs((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt__exit__cscCs*|jp i}t|tjƒs0t|ƒ}ntttƒ|jƒ|ƒ}|j}|jrƒ| rƒ|j rƒt |j ƒ}nt ƒ}|j d|j jƒd|j d|jd|jd|jdt|j|jdtƒdt|j|jƒd t||jƒd |d t|j|jƒƒ |S( sbConstructs a :class:`PreparedRequest ` for transmission and returns it. The :class:`PreparedRequest` has settings merged from the :class:`Request ` instance and those of the :class:`Session`. :param request: :class:`Request` instance to prepare with this session's settings. RyRKtfilestdatatjsonRIR'RƒRRXR‚(RXR"Rt CookieJarRR R RRkRRKR tprepareRytupperRŒRRŽR-RIRRƒR2R‚(R]RiRXtmerged_cookiesRtp((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytprepare_requestfs*        cCsÇtd|jƒd|d|d|d|p-id|d|p?id|d |d | ƒ }|j|ƒ}| poi} |j|j| | ||ƒ}i| d 6| d 6}|j|ƒ|j||}|S( sŒConstructs a :class:`Request `, prepares it and sends it. Returns :class:`Response ` object. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param headers: (optional) Dictionary of HTTP Headers to send with the :class:`Request`. :param cookies: (optional) Dict or CookieJar object to send with the :class:`Request`. :param files: (optional) Dictionary of ``'filename': file-like-objects`` for multipart encoding upload. :param auth: (optional) Auth tuple or callable to enable Basic/Digest/Custom HTTP Auth. :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 allow_redirects: (optional) Set to True by default. :type allow_redirects: bool :param proxies: (optional) Dictionary mapping protocol or protocol and hostname to the URL of the proxy. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) whether the SSL cert will be verified. A CA_BUNDLE path can also be provided. Defaults to ``True``. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. :rtype: requests.Response RyRKRIRŒRRŽRƒRRXR‚R8R<(R R‘R”tmerge_environment_settingsRKR#R\(R]RyRKRƒRRIRXRŒRR8R<R;R‚R7R9R:RŽR_tpreptsettingst send_kwargsR^((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyRiŽs*3       cKs#|jdtƒ|jd||S(sÃSends a GET request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. R<Rw(RpRRi(R]RKtkwargs((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyR/ßscKs#|jdtƒ|jd||S(sÇSends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. R<tOPTIONS(RpRRi(R]RKR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytoptionséscKs#|jdtƒ|jd||S(sÄSends a HEAD request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. R<Rv(RpRFRi(R]RKR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytheadóscKs|jd|d|d||S(sŠSends a POST request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param json: (optional) json to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. RxRRŽ(Ri(R]RKRRŽR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytpostýs cKs|jd|d||S(s7Sends a PUT request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. tPUTR(Ri(R]RKRR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytputscKs|jd|d||S(s9Sends a PATCH request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param data: (optional) Dictionary, bytes, or file-like object to send in the body of the :class:`Request`. :param \*\*kwargs: Optional arguments that ``request`` takes. tPATCHR(Ri(R]RKRR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytpatchscKs|jd||S(sÆSends a DELETE request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. tDELETE(Ri(R]RKR™((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pytdeletescKs#|jd|jƒ|jd|jƒ|jd|jƒ|jd|jƒt|tƒrjtdƒ‚n|jdt ƒ}|j dƒ}|j }|rýt ƒ}xW|j |jkrù|j|j ƒ|jj |j ƒ}||kríPn||_ q¦Wn|jd|j ƒ}tjƒ} |j||} tjƒ| | _td|| |} | jr‘x-| jD]} t|j| j| jƒqkWnt|j|| jƒ|j| ||} |rÛg| D]} | ^qÉng} | r| jd | ƒ| jƒ} | | _n|s| jn| S( sSend a given PreparedRequest.R7R9R:R;s#You can only send PreparedRequests.R<RKR.i(RpR7R9R:R;R"R t ValueErrortpopRR/R‚tsetRKRPtaddt get_adapterRtutcnowR\telapsedRRARRXRiRDRgtinsertRB(R]RiR™R<R7R‚t checked_urlstnew_urltadaptertstarttrR^tgenRA((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyR\%sF      %   c Csò|jrŠt|ƒpi}x*|jƒD]\}}|j||ƒq(W|tks`|dkrŠtjjdƒptjjdƒ}qŠnt ||j ƒ}t ||j ƒ}t ||j ƒ}t ||j ƒ}i|d6|d6|d6|d6S(s6Check the environment and merge it with some settings.tREQUESTS_CA_BUNDLEtCURL_CA_BUNDLER9R;R7R:N(RkRR$RpRR!tostenvironR/R-R;R7R9R:( R]RKR;R7R9R:t env_proxiesR)R*((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyR•ms cCsMx6|jjƒD]%\}}|jƒj|ƒr|SqWtd|ƒ‚dS(s=Returns the appropriate connection adapter for the given URL.s*No connection adapters were found for '%s'N(R…R$tlowerRJR(R]RKtprefixR®((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyR¨…scCs(x!|jjƒD]}|jƒqWdS(s+Closes all adapters and as such the sessionN(R…tvaluesRH(R]R*((sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyRHscCso||j| sRP(tdictt __attrs__RP(R]tstate((R]sB/opt/alt/python27/lib/python2.7/site-packages/requests/sessions.pyt __getstate__ŸscCs||jdiƒ}x*|jƒD]\}}t|||ƒqWttƒ|_x'|jƒD]\}}||j| s. """( ¶ÿŸ