Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
¸EYc@s%dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZm
Z
mZmZddlmZmZmZmZdd	lmZmZmZdd
lmZmZddlmZddlmZm Z dd
l!m"Z"m#Z#m$Z$m%Z%ddl&m'Z'ddl(m)Z)ddlm*Z*m+Z+m,Z,m-Z-m.Z.m/Z/ddl0m1Z1ddlm2Z2ej3ƒdkrËy
ej4Z5Wne6k
rÇej7Z5nXn	ejZ5e
d„Z8e
d„Z9de:fd„ƒYZ;de;fd„ƒYZ<d„Z=dS(s“
requests.session
~~~~~~~~~~~~~~~~

This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
iÿÿÿÿN(tMapping(t	timedeltai(t_basic_auth_str(t	cookielibtis_py3tOrderedDictturljointurlparse(tcookiejar_from_dicttextract_cookies_to_jartRequestsCookieJart
merge_cookies(tRequesttPreparedRequesttDEFAULT_REDIRECT_LIMIT(t
default_hookst
dispatch_hook(tto_native_string(tto_key_val_listtdefault_headers(tTooManyRedirectst
InvalidSchematChunkedEncodingErrortContentDecodingError(tCaseInsensitiveDict(tHTTPAdapter(trequote_uritget_environ_proxiestget_netrc_authtshould_bypass_proxiestget_auth_from_urltrewind_body(tcodes(tREDIRECT_STATItWindowscCs´|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((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt
merge_setting2s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)((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytmerge_hooksQs
!!tSessionRedirectMixincBsGeZd„Zededded„Zd„Zd„Zd„Z	RS(cCs?|jr;|jd}tr.|jdƒ}nt|dƒSdS(s7Receives a Response. Returns a redirect URI or ``None``tlocationtlatin1tutf8N(tis_redirecttheadersRtencodeRR#(tselftrespR6((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytget_redirect_targetbs	

c	ksèg}
|j|ƒ}xÌ|rã|jƒ}|
j|ƒ|
d|_y|jWn-tttfk
r~|jj	dt
ƒnXt|jƒ|jkr³t
d|jd|ƒ‚n|jƒ|jdƒr÷t|jƒ}
dt|
jƒ|f}nt|ƒ}|jƒ}|js3t|jt|ƒƒ}nt|ƒ}t|ƒ|_|j||ƒ|jtjtjfkr¯d}x!|D]}|jj|dƒq†Wd|_ n|j}y|d
=Wnt!k
rÖnXt"|j#||jƒt$|j#|j%ƒ|j&|j#ƒ|j'||ƒ}|j(||ƒ|j)dk	oVd|kpVd	|k}|rlt*|ƒn|}|r€|Vq|j+|d|d|d
|d|d|dt
|	}t"|j%||jƒ|j|ƒ}|VqWdS(sBReceives a Response. Returns a generator of Responses or Requests.itdecode_contentsExceeded %s redirects.R0s//s%s:%ssContent-LengthsContent-TypesTransfer-EncodingtCookietstreamttimeouttverifytcerttproxiestallow_redirectsN(sContent-LengthsContent-TypesTransfer-Encoding(,R>tcopytappendthistorytcontentRRtRuntimeErrortrawtreadtFalsetlent
max_redirectsRtcloset
startswithRturlRtschemetgeturltnetlocRRtrebuild_methodtstatus_codeR ttemporary_redirecttpermanent_redirectR:tpopR#tbodytKeyErrorR	t_cookiesRtcookiestprepare_cookiestrebuild_proxiestrebuild_autht_body_positionRtsend(R<R=treqRARBRCRDREtyield_requeststadapter_kwargsthistRStprepared_requesttparsed_rurltparsedtpurged_headerstheaderR:t
rewindable((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytresolve_redirectsqsr	


	
	

	cCs–|j}|j}d|kr[t|jjƒ}t|ƒ}|j|jkr[|d=q[n|jrpt|ƒnd}|dk	r’|j|ƒ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(	R:RSRtrequestthostnamet	trust_envRR#tprepare_auth(R<RiR0R:RStoriginal_parsedtredirect_parsedtnew_auth((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRbÝs		
c
Cs5|dk	r|ni}|j}|j}t|ƒj}|jƒ}|jdƒ}t|d|ƒ}|jr¿|r¿t	|d|ƒ}	|	j||	jdƒƒ}
|
r¿|j
||
ƒq¿nd|krÕ|d=nyt||ƒ\}}Wntk
rd\}}nX|r1|r1t
||ƒ|d<n|S(s°This method re-evaluates the proxy configuration by considering the
        environment variables. If we are redirected to a URL covered by
        NO_PROXY, we strip the proxy configuration. Otherwise, we set missing
        proxy keys for this URL (in case they were stripped by a previous
        redirect).

        This method also replaces the Proxy-Authorization header where
        necessary.

        :rtype: dict
        tno_proxytallsProxy-AuthorizationN(NN(R#R:RSRRTRGR1RRsRt
setdefaultRR]R(
R<RiRER:RSRTtnew_proxiesRxtbypass_proxytenviron_proxiestproxytusernametpassword((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRaõ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(tmethodRXR t	see_othertfoundtmoved(R<RiR0R„((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRWs				N(
t__name__t
__module__R>RNR#tTrueRoRbRaRW(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyR5`s	k		)tSessioncBseZdZddddddddd	d
ddd
g
Zd„Zd„Zd„Zd„Zd!d!d!d!d!d!d!e	d!d!d!d!d!d!d„Z
d„Zd„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')
      <Response [200]>

    Or as a context manager::

      >>> with requests.Session() as s:
      >>>     s.get('http://httpbin.org/get')
      <Response [200]>
    R:R_tauthREthookstparamsRCRDtprefetchtadaptersRARsRPcCs¥tƒ|_d|_i|_tƒ|_i|_t|_	t
|_d|_t
|_t
|_tiƒ|_tƒ|_|jdtƒƒ|jdtƒƒdS(Nshttps://shttp://(RR:R#RŒRERRRŽRNRARŠRCRDRRPRsRR_RRtmountR(R<((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt__init__Ns								cCs|S(N((R<((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt	__enter__…scGs|jƒdS(N(RQ(R<targs((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt__exit__ˆscCs*|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
|dt|j|jƒƒ
|S(s‹Constructs a :class:`PreparedRequest <PreparedRequest>` for
        transmission and returns it. The :class:`PreparedRequest` has settings
        merged from the :class:`Request <Request>` instance and those of the
        :class:`Session`.

        :param request: :class:`Request` instance to prepare with this
            session's settings.
        :rtype: requests.PreparedRequest
        R„RStfilestdatatjsonR:R)RŽRŒR_R(R_R$Rt	CookieJarRRR
RŒRsRRSR
tprepareR„tupperR–R—R˜R/R:RRŽR4R(R<RqR_tmerged_cookiesRŒtp((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytprepare_request‹s*
							cCsÇtd|jƒd|d|d|d|p-id|d|p?id|d	|d
|ƒ
}|j|ƒ}|poi}|j|j||
||ƒ}i|	d6|
d6}|j|ƒ|j||}|S(
sñConstructs a :class:`Request <Request>`, prepares it and sends it.
        Returns :class:`Response <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) <timeouts>` 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) Either a boolean, in which case it controls whether we verify
            the server's TLS certificate, or a string, in which case it must be a path
            to a CA bundle to use. Defaults to ``True``.
        :param cert: (optional) if String, path to ssl client cert file (.pem).
            If Tuple, ('cert', 'key') pair.
        :rtype: requests.Response
        R„RSR:R–R—R˜RŽRŒR_RRBRF(RR›Ržtmerge_environment_settingsRSR%Rd(R<R„RSRŽR—R:R_R–RŒRBRFRERRARCRDR˜Retpreptsettingstsend_kwargsR=((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRq³s*)	

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.
        :rtype: requests.Response
        RFR‚(RzRŠRq(R<RStkwargs((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyR1ú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.
        :rtype: requests.Response
        RFtOPTIONS(RzRŠRq(R<RSR£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytoptionsscKs#|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.
        :rtype: requests.Response
        RFR(RzRNRq(R<RSR£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytheadscKs|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.
        :rtype: requests.Response
        RƒR—R˜(Rq(R<RSR—R˜R£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytposts
cKs|jd|d||S(sYSends 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.
        :rtype: requests.Response
        tPUTR—(Rq(R<RSR—R£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytput's	cKs|jd|d||S(s[Sends 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.
        :rtype: requests.Response
        tPATCHR—(Rq(R<RSR—R£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytpatch2s	cKs|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.
        :rtype: requests.Response
        tDELETE(Rq(R<RSR£((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytdelete=sc
Ks|jd|jƒ|jd|jƒ|jd|jƒ|jd|jƒt|tƒrjtdƒ‚n|jdt	ƒ}|j
dƒ}|j}|jd|j
ƒ}tƒ}|j||}tƒ|}	td|	ƒ|_td	|||}|jr1x-|jD]}
t|j|
j|
jƒqWnt|j||jƒ|j|||}|r{g|D]}
|
^qing}|r¯|jd
|ƒ|jƒ}||_n|sôy(t|j||dt	|ƒ|_Wqôtk
rðqôXn|s|jn|S(sISend a given PreparedRequest.

        :rtype: requests.Response
        RARCRDREs#You can only send PreparedRequests.RFRStsecondsR0iRf(RzRARCRDRER$Rt
ValueErrorR[RŠR1Rtget_adapterRStpreferred_clockRdRtelapsedRRIR	R_RqRLRotinserttnextt_nextt
StopIterationRJ(
R<RqR£RFRARtadaptertstarttrR²R=tgenRI((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRdGsB		
	 %(

c
Cs|jr«|dk	r$|jdƒnd}t|d|ƒ}x*|jƒD]\}}	|j||	ƒqIW|tks|dkr«tjjdƒp¢tjjdƒ}q«nt	||j
ƒ}t	||jƒ}t	||jƒ}t	||j
ƒ}i|d6|d6|d6|d6S(	s^
        Check the environment and merge it with some settings.

        :rtype: dict
        RxtREQUESTS_CA_BUNDLEtCURL_CA_BUNDLERCRERARDN(RsR#R1RR&RzRŠtostenvironR/RERARCRD(
R<RSRERARCRDRxtenv_proxiesR+R,((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRŸs	!cCsMx6|jjƒD]%\}}|jƒj|ƒr|SqWtd|ƒ‚dS(s~
        Returns the appropriate connection adapter for the given URL.

        :rtype: requests.adapters.BaseAdapter
        s*No connection adapters were found for '%s'N(RR&tlowerRRR(R<RStprefixR·((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyR°­scCs(x!|jjƒD]}|jƒqWdS(s+Closes all adapters and as such the sessionN(RtvaluesRQ(R<R,((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyRQ»scCso||j|<g|jD]$}t|ƒt|ƒkr|^q}x'|D]}|jj|ƒ|j|<qHWdS(stRegisters a connection adapter to a prefix.

        Adapters are sorted in descending order by key length.
        N(RROR[(R<RÁR·R+tkeys_to_moveR.((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyR‘Às
4
cs#t‡fd†ˆjDƒƒ}|S(Nc3s'|]}|tˆ|dƒfVqdS(N(tgetattrR#(t.0tattr(R<(sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pys	<genexpr>Ìs(tdictt	__attrs__(R<tstate((R<sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt__getstate__ËscCs1x*|jƒD]\}}t|||ƒq
WdS(N(R&tsetattr(R<RÉRÆtvalue((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt__setstate__ÏsN(RˆR‰t__doc__RÈR’R“R•RžR#RŠRqR1R¥R¦R§R©R«R­RdRŸR°RQR‘RÊRÍ(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyR‹5s2		7			)D				
	I					cCstƒS(sQ
    Returns a :class:`Session` for context-management.

    :rtype: Session
    (R‹(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pytsessionÔs(>RÎR½tplatformttimetcollectionsRtdatetimeRRŒRtcompatRRRRRR_RR	R
RtmodelsRR
RRRRt_internal_utilsRtutilsRRt
exceptionsRRRRt
structuresRRRRRRRRRtstatus_codesR R!tsystemtperf_counterR±tAttributeErrortclockR/R4tobjectR5R‹RÏ(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/requests/sessions.pyt<module>	s<("".

	Õÿ