/usr/lib/python2.6/site-packages/requests
NameSizeModeActions
packages/-0755rm
adapters.py168100644editdlrm
adapters.pyc158050644editdlrm
adapters.pyo158050644editdlrm
api.py52800644editdlrm
api.pyc60350644editdlrm
api.pyo60350644editdlrm
auth.py67100644editdlrm
auth.pyc75850644editdlrm
auth.pyo75850644editdlrm
cacert.pem3084340644editdlrm
certs.py6490644editdlrm
certs.pyc9010644editdlrm
certs.pyo9010644editdlrm
compat.py15490644editdlrm
compat.pyc17000644editdlrm
compat.pyo17000644editdlrm
cookies.py167910644editdlrm
cookies.pyc204060644editdlrm
cookies.pyo204060644editdlrm
exceptions.py25170644editdlrm
exceptions.pyc52880644editdlrm
exceptions.pyo52880644editdlrm
hooks.py8200644editdlrm
hooks.pyc10660644editdlrm
hooks.pyo10660644editdlrm
models.py281560644editdlrm
models.pyc251620644editdlrm
models.pyo251620644editdlrm
sessions.py244760644editdlrm
sessions.pyc200580644editdlrm
sessions.pyo200580644editdlrm
status_codes.py32000644editdlrm
status_codes.pyc44700644editdlrm
status_codes.pyo44700644editdlrm
structures.py29770644editdlrm
structures.pyc51500644editdlrm
structures.pyo51500644editdlrm
utils.py213340644editdlrm
utils.pyc206770644editdlrm
utils.pyo206770644editdlrm
__init__.py18610644editdlrm
__init__.pyc25190644editdlrm
__init__.pyo25190644editdlrm
Edit: /usr/lib/python2.6/site-packages/requests/sessions.pyo (20058B)
Ñò bUc@sÅdZddkZddklZddklZddklZddklZl Z l Z l Z ddk l Z lZlZlZdd klZlZlZdd klZlZdd klZlZlZdd klZlZlZl Z dd k!l"Z"ddk#l$Z$ddk%l&Z&ddkl'Z'l(Z(l)Z)l*Z*l+Z+ddk,l-Z-ddkl.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Ã|djo|S|djo|St|tƒo t|tƒp|S|t|ƒƒ}|it|ƒƒx2|iƒD]$\}}|djo ||=q{q{Wtd„|iƒDƒƒ}|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` css6x/|](\}}|dj o||fVqqWdS(N(tNone(t.0tktv((s5/usr/lib/python2.6/site-packages/requests/sessions.pys Fs N(R!t isinstanceRRtupdatetitemstdict(trequest_settingtsession_settingt dict_classtmerged_settingR#R$((s5/usr/lib/python2.6/site-packages/requests/sessions.pyt merge_setting*s    cCs`|djp|idƒgjo|S|djp|idƒgjo|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+((s5/usr/lib/python2.6/site-packages/requests/sessions.pyt merge_hooksKs ##tSessionRedirectMixincBs2eZededdd„Zd„Zd„ZRS(ccsYd}g} xF|io;|iƒ} |djo&| i|ƒt| ƒ} | |_ny |iWn/tttfj o|i i dt ƒnX||i jot d|i ƒ‚n|iƒ|id} |i} | idƒo&t|iƒ}d|i| f} nt| ƒ}|iƒ} |ipt|it| ƒƒ} n t| ƒ} t| ƒ| _|io*|i| ijo| i|i|itithisttprepared_requesttnew_histRORMt parsed_rurltparsedRL((s5/usr/lib/python2.6/site-packages/requests/sessions.pytresolve_redirects\s~                          cCsž|i}|i}d|jo@t|iiƒ}t|ƒ}|i|ijo |d=q_n|io t|ƒnd}|dj o|i|ƒndS(sò When being redirected we may want to strip authentication from the request to avoid leaking credentials. This method intelligently removes and reapplies authentication where possible to avoid credential loss. t AuthorizationN( RLRORtrequestthostnamet trust_envRR!t prepare_auth(RcRhR.RLROtoriginal_parsedtredirect_parsedtnew_auth((s5/usr/lib/python2.6/site-packages/requests/sessions.pyRaËs     c Cs|i}|i}t|ƒi}|dj o |iƒnh}|ioLt|ƒ o>t|ƒ}|i |ƒ}|o|i |||ƒq—nd|jo |d=nyt ||ƒ\} } Wnt j od\} } nX| o| ot | | ƒ|dRLRORPt new_proxiestenviron_proxiestproxytusernametpassword((s5/usr/lib/python2.6/site-packages/requests/sessions.pyR`äs$      N(t__name__t __module__RIR!tTrueRlRaR`(((s5/usr/lib/python2.6/site-packages/requests/sessions.pyR3[sn 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') 200 RLR^tauthR>thookstparamsR<R=tprefetchtadaptersR:RpRJcCs´tƒ|_d|_h|_tƒ|_h|_t|_ t |_ d|_ t |_t |_thƒ|_tƒ|_|idtƒƒ|idtƒƒttƒ|_dS(Nshttps://shttp://(RRLR!RR>RR€RRIR:R}R<R=R RJRpRR^RRƒtmountRRtREDIRECT_CACHE_SIZERT(Rc((s5/usr/lib/python2.6/site-packages/requests/sessions.pyt__init__s           cCs|S(N((Rc((s5/usr/lib/python2.6/site-packages/requests/sessions.pyt __enter__SscGs|iƒdS(N(RK(Rctargs((s5/usr/lib/python2.6/site-packages/requests/sessions.pyt__exit__VscCs1|iph}t|tiƒpt|ƒ}ntttƒ|iƒ|ƒ}|i}|io&| o|i ot |i ƒ}nt ƒ}|i d|i iƒd|i d|id|id|idt|i|idtƒdt|i|iƒd t||iƒd |d t|i|iƒƒ |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. RMROtfilestdatatjsonRLR+RRR^R€(R^R%Rt CookieJarRR R RRpRROR tprepareRMtupperRŠR‹RŒR-RLRRR2R€(RcRnR^tmerged_cookiesRtp((s5/usr/lib/python2.6/site-packages/requests/sessions.pytprepare_requestYs*        cCsÖt|ƒ}td|iƒd|d|d|d|phd|d|phd|d |d | ƒ }|i|ƒ}| ph} |i|i| | ||ƒ}h| d 6| d 6}|i|ƒ|i||}|S( sCConstructs 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 or bytes 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 (`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 to the URL of the proxy. :param stream: (optional) whether to immediately download the response content. Defaults to ``False``. :param verify: (optional) if ``True``, the SSL cert will be verified. A CA_BUNDLE path can also be provided. :param cert: (optional) if String, path to ssl client cert file (.pem). If Tuple, ('cert', 'key') pair. RMRORLRŠR‹RŒRRR^R€R;R?(RR RR’tmerge_environment_settingsROR&Rb(RcRMRORR‹RLR^RŠRR;R?R>R€R:R<R=RŒRetpreptsettingst send_kwargsRd((s5/usr/lib/python2.6/site-packages/requests/sessions.pyRns,2        cKs#|idtƒ|id||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?R7(RuR}Rn(RcROtkwargs((s5/usr/lib/python2.6/site-packages/requests/sessions.pyR/ÔscKs#|idtƒ|id||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(RuR}Rn(RcROR—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytoptionsÞscKs#|idtƒ|id||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?R6(RuRIRn(RcROR—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytheadèscKs|id|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. R8R‹RŒ(Rn(RcROR‹RŒR—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytpostòs cKs|id|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‹(Rn(RcROR‹R—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytputýscKs|id|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‹(Rn(RcROR‹R—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytpatchscKs|id||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(Rn(RcROR—((s5/usr/lib/python2.6/site-packages/requests/sessions.pytdeletescKs‡|id|iƒ|id|iƒ|id|iƒ|id|iƒt|tƒptdƒ‚ntƒ}xX|i |i joD|i |i ƒ|i i |i ƒ}||joPn||_ qxW|i dtƒ}|i dƒ}|i dƒ}|i dƒ}|i dƒ} |i dƒ} |i} |id|i ƒ} tiƒ} | i||}tiƒ| |_td | ||}|io1x.|iD]}t|i|i|iƒq¥Wnt|i||iƒ|i||d|d|d|d| d| ƒ}|o"g}|D] }||q$~ng}|o)|id |ƒ|i ƒ}||_n|p |in|S( sSend a given PreparedRequest.R:R<R=R>s#You can only send PreparedRequests.R?R;ROR.i(RuR:R<R=R>R%R t ValueErrortsetRORTtaddR/tpopR}R€t get_adapterRtutcnowRbtelapsedRRDRR^RnRGRltinsertRE(RcRnR—t checked_urlstnew_urlR?R:R;R<R=R>R€tadaptertstarttrRdtgent_[1]RD((s5/usr/lib/python2.6/site-packages/requests/sessions.pyRbsZ      ! /   c Csù|io‡t|ƒph}x*|iƒD]\}}|i||ƒq*W|tjp |djo)tiidƒptiidƒ}q‘nt ||i ƒ}t ||i ƒ}t ||i ƒ}t ||i ƒ}h|d6|d6|d6|d6S(s6Check the environment and merge it with some settings.tREQUESTS_CA_BUNDLEtCURL_CA_BUNDLER<R>R:R=N(RpRR'RuR}R!tostenvironR/R-R>R:R<R=( RcROR>R:R<R=t env_proxiesR#R$((s5/usr/lib/python2.6/site-packages/requests/sessions.pyR“is  cCsOx8|iiƒD]'\}}|iƒi|ƒo|SqWtd|ƒ‚dS(s>Returns the appropriate connnection adapter for the given URL.s*No connection adapters were found for '%s'N(RƒR'tlowerRNR(RcROtprefixR¬((s5/usr/lib/python2.6/site-packages/requests/sessions.pyR¦s   cCs(x!|iiƒD]}|iƒqWdS(s+Closes all adapters and as such the sessionN(RƒtvaluesRK(RcR$((s5/usr/lib/python2.6/site-packages/requests/sessions.pyRK‹scCs|||i|œs RT(R(t __attrs__RT(Rctstate((Rcs5/usr/lib/python2.6/site-packages/requests/sessions.pyt __getstate__›scCs||idhƒ}x*|iƒD]\}}t|||ƒqWttƒ|_x'|iƒD]\}}||i| s. """( ! ¯ÿ¡