%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/
Upload File :
Create Path :
Current File : //opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyo

�
�wMVc@s$dZddlZddlZddlmZmZmZmZyddlZeWne	k
rsddl
ZnXdefd��YZdefd��YZ
d	�Zd
�Zddd�Zdefd
��YZdejejfd��YZd�Zd�Zded�Zd�ZdS(s�
Compatibility code to be able to use `cookielib.CookieJar` with requests.

requests.utils imports from here, so be careful with imports.
i����Ni(t	cookielibturlparset
urlunparsetMorseltMockRequestcBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	dd�Zd	�Zd
�Z
d�Zed��Zed
��Zed��ZRS(s�Wraps a `requests.Request` to mimic a `urllib2.Request`.

    The code in `cookielib.CookieJar` expects this interface in order to correctly
    manage cookie policies, i.e., determine whether a cookie can be set, given the
    domains of the request and the cookie.

    The original request object is read-only. The client is responsible for collecting
    the new headers via `get_new_headers()` and interpreting them appropriately. You
    probably want `get_cookie_header`, defined below.
    cCs.||_i|_t|jj�j|_dS(N(t_rt_new_headersRturltschemettype(tselftrequest((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__init__!s		cCs|jS(N(R	(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_type&scCst|jj�jS(N(RRRtnetloc(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_host)scCs
|j�S(N(R(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_origin_req_host,scCsl|jjjd�s|jjS|jjd}t|jj�}t|j||j|j|j	|j
g�S(NtHost(RtheaderstgetRRRRtpathtparamstquerytfragment(R
thosttparsed((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_full_url/s
cCstS(N(tTrue(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytis_unverifiable=scCs||jjkp||jkS(N(RRR(R
tname((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
has_header@scCs%|jjj||jj||��S(N(RRRR(R
Rtdefault((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
get_headerCscCstd��dS(sMcookielib has no legitimate use for this method; add it back if you find one.s=Cookie headers should be added with add_unredirected_header()N(tNotImplementedError(R
tkeytval((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
add_headerFscCs||j|<dS(N(R(R
Rtvalue((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytadd_unredirected_headerJscCs|jS(N(R(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_new_headersMscCs
|j�S(N(R(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytunverifiablePscCs
|j�S(N(R(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytorigin_req_hostTscCs
|j�S(N(R(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRXsN(t__name__t
__module__t__doc__RR
RRRRRtNoneR R$R&R'tpropertyR(R)R(((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRs
										tMockResponsecBs)eZdZd�Zd�Zd�ZRS(s�Wraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.

    ...what? Basically, expose the parsed HTTP headers from the server response
    the way `cookielib` expects to see them.
    cCs
||_dS(s�Make a MockResponse for `cookielib` to read.

        :param headers: a httplib.HTTPMessage or analogous carrying the headers
        N(t_headers(R
R((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRdscCs|jS(N(R0(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytinfokscCs|jj|�dS(N(R0t
getheaders(R
R((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR2ns(R*R+R,RR1R2(((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR/]s		cCsNt|d�o|jsdSt|�}t|jj�}|j||�dS(s�Extract the cookies from the response into a CookieJar.

    :param jar: cookielib.CookieJar (not necessarily a RequestsCookieJar)
    :param request: our own requests.Request object
    :param response: urllib3.HTTPResponse object
    t_original_responseN(thasattrR3RR/tmsgtextract_cookies(tjarRtresponsetreqtres((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytextract_cookies_to_jarrs	cCs,t|�}|j|�|j�jd�S(sOProduce an appropriate Cookie header string to be sent with `request`, or None.tCookie(Rtadd_cookie_headerR'R(R7Rtr((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_cookie_header�s
cCs�g}x{|D]s}|j|kr
|dks=||jkr�|dksX||jkr}|j|j|j|jf�q}q�q
q
Wx*|D]"\}}}|j|||�q�WdS(skUnsets a cookie by name, by default over all domains and paths.

    Wraps CookieJar.clear(), is O(n).
    N(RR-tdomainRtappendtclear(t	cookiejarRR@Rt
clearablestcookie((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytremove_cookie_by_name�s
,tCookieConflictErrorcBseZdZRS(s�There are two cookies that meet the criteria specified in the cookie jar.
    Use .get and .set and include domain and path args in order to be more specific.(R*R+R,(((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRG�stRequestsCookieJarcBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zddd�Zd
�Zd�Zd�Zd�Zd�Zddd�Zddd�Zd�Zd�Zd�ZRS(s�Compatibility class; is a cookielib.CookieJar, but exposes a dict interface.

    This is the CookieJar we create by default for requests and sessions that
    don't specify one, since some clients may expect response.cookies and
    session.cookies to support dict operations.

    Don't use the dict interface internally; it's just for compatibility with
    with external client code. All `requests` code should work out of the box
    with externally provided instances of CookieJar, e.g., LWPCookieJar and
    FileCookieJar.

    Caution: dictionary operations that are normally O(1) may be O(n).

    Unlike a regular CookieJar, this class is pickleable.
    cCs0y|j|||�SWntk
r+|SXdS(s�Dict-like get() that also supports optional domain and path args in
        order to resolve naming collisions from using one cookie jar over
        multiple domains. Caution: operation is O(n), not O(1).N(t_find_no_duplicatestKeyError(R
RRR@R((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyR�s
cKs||dkr;t||d|jd�d|jd��dSt|t�rYt|�}nt|||�}|j|�|S(s�Dict-like set() that also supports optional domain and path args in
        order to resolve naming collisions from using one cookie jar over
        multiple domains.R@RN(R-RFRt
isinstanceRtmorsel_to_cookiet
create_cookiet
set_cookie(R
RR%tkwargstc((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytset�s+
ccs#xt|�D]}|jVq
WdS(syDict-like iterkeys() that returns an iterator of names of cookies from the jar.
        See itervalues() and iteritems().N(titerR(R
RE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytiterkeys�scCst|j��S(shDict-like keys() that returns a list of names of cookies from the jar.
        See values() and items().(tlistRS(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytkeys�sccs#xt|�D]}|jVq
WdS(szDict-like itervalues() that returns an iterator of values of cookies from the jar.
        See iterkeys() and iteritems().N(RRR%(R
RE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
itervalues�scCst|j��S(siDict-like values() that returns a list of values of cookies from the jar.
        See keys() and items().(RTRV(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytvalues�sccs,x%t|�D]}|j|jfVq
WdS(szDict-like iteritems() that returns an iterator of name-value tuples from the jar.
        See iterkeys() and itervalues().N(RRRR%(R
RE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt	iteritems�scCst|j��S(s�Dict-like items() that returns a list of name-value tuples from the jar.
        See keys() and values(). Allows client-code to call "dict(RequestsCookieJar)
        and get a vanilla python dict of key value pairs.(RTRX(R
((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytitems�scCsCg}x6t|�D](}|j|kr|j|j�qqW|S(s2Utility method to list all the domains in the jar.(RRR@RA(R
tdomainsRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytlist_domains�s
cCsCg}x6t|�D](}|j|kr|j|j�qqW|S(s0Utility method to list all the paths in the jar.(RRRRA(R
tpathsRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
list_paths�s
cCsSg}xFt|�D]8}|jdk	r;|j|kr;tS|j|j�qWtS(sWReturns True if there are multiple domains in the jar.
        Returns False otherwise.N(RRR@R-RRAtFalse(R
RZRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytmultiple_domains�scCsji}x]t|�D]O}|dks4|j|kr|dksO|j|kr|j||j<qqW|S(s�Takes as an argument an optional domain and path and returns a plain old
        Python dict of name-value pairs of cookies that meet the requirements.N(RRR-R@RR%R(R
R@Rt
dictionaryRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytget_dicts'cCs
|j|�S(s�Dict-like __getitem__() for compatibility with client code. Throws exception
        if there are more than one cookie with name. In that case, use the more
        explicit get() method instead. Caution: operation is O(n), not O(1).(RI(R
R((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__getitem__scCs|j||�dS(s�Dict-like __setitem__ for compatibility with client code. Throws exception
        if there is already a cookie of that name in the jar. In that case, use the more
        explicit set() method instead.N(RQ(R
RR%((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__setitem__scCst||�dS(sSDeletes a cookie given a name. Wraps cookielib.CookieJar's remove_cookie_by_name().N(RF(R
R((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__delitem__scOsmt|jd�rQ|jjd�rQ|jjd�rQ|jjdd�|_ntt|�j|||�S(Nt
startswitht"s\"t(R4R%RetendswithtreplacetsuperRHRN(R
REtargsRO((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRN!s6cCsMt|tj�r3x4|D]}|j|�qWntt|�j|�dS(sAUpdates this jar with cookies from another CookieJar or dict-likeN(RKRt	CookieJarRNRjRHtupdate(R
totherRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRm&s
cCs�xft|�D]X}|j|kr
|dks=|j|kre|dksX|j|krb|jSqeq
q
Wtd|||f��dS(s6Requests uses this method internally to get cookie values. Takes as args name
        and optional domain and path. Returns a cookie.value. If there are conflicting cookies,
        _find arbitrarily chooses one. See _find_no_duplicates if you want an exception thrown
        if there are conflicting cookies.sname=%r, domain=%r, path=%rN(RRRR-R@RR%RJ(R
RR@RRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt_find.scCs�d}x�t|�D]|}|j|kr|dksC|j|kr�|dks^|j|kr�|dk	r}td|��n|j}q�q�qqW|r�|Std|||f��dS(sA__get_item__ and get call _find_no_duplicates -- never used in Requests internally.
        Takes as args name and optional domain and path. Returns a cookie.value.
        Throws KeyError if cookie is not found and CookieConflictError if there are
        multiple cookies that match name and optionally domain and path.s(There are multiple cookies with name, %rsname=%r, domain=%r, path=%rN(R-RRRR@RRGR%RJ(R
RR@RttoReturnRE((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRI;scCs |jj�}|jd�|S(s4Unlike a normal CookieJar, this class is pickleable.t
_cookies_lock(t__dict__tcopytpop(R
tstate((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__getstate__Ms
cCs5|jj|�d|jkr1tj�|_ndS(s4Unlike a normal CookieJar, this class is pickleable.RqN(RrRmt	threadingtRLockRq(R
Ru((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt__setstate__TscCst�}|j|�|S(s(Return a copy of this RequestsCookieJar.(RHRm(R
tnew_cj((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRsZs	
N(R*R+R,R-RRQRSRURVRWRXRYR[R]R_RaRbRcRdRNRmRoRIRvRyRs(((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRH�s.											

					
		cKstddd|d|dddddd	d
tdddtd
ddddidd6dt�
}t|�t|�}|r�d}t|t|���n|j|�t|d�|d<t|d�|d<|dj	d�|d<t|d�|d<t
j|�S(s�Make a cookie from underspecified parameters.

    By default, the pair of `name` and `value` will be set for the domain ''
    and sent on every request (this is sometimes called a "supercookie").
    tversioniRR%tportR@RgRt/tsecuretexpirestdiscardtcommenttcomment_urltresttHttpOnlytrfc2109s4create_cookie() got unexpected keyword arguments: %stport_specifiedtdomain_specifiedt.tdomain_initial_dottpath_specifiedN(tdictR-R^RRQt	TypeErrorRTRmtboolReRR<(RR%ROtresulttbadargsterr((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRMas0
	
cCs�d}|dr'tj�|d}n9|dr`d}tjtj|d|��tj}ntd|ddt|d�dtd|dd|d|jd	|d	d
ddi|dd
6dtdt|d�d|j	d|dp�d�
S(sBConvert a Morsel object into a Cookie containing the one k/v pair.smax-ageRs%a, %d-%b-%Y %H:%M:%S GMTR�R�R�R@RRR|R�thttponlyR�R�R~R%R{iN(
R-ttimetmktimetstrptimettimezoneRMR�R^R"R%(tmorselRt
time_template((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyRL�s*

#

	
	cCs�|dkrt�}n|dk	r�g|D]}|j^q+}x@|D]5}|s_||krG|jt|||��qGqGWn|S(s-Returns a CookieJar from a key/value dictionary.

    :param cookie_dict: Dict of key/values to insert into CookieJar.
    :param cookiejar: (optional) A cookiejar to add the cookies to.
    :param overwrite: (optional) If False, will not replace cookies
        already in the jar with new ones.
    N(R-RHRRNRM(tcookie_dictRCt	overwriteREtnames_from_jarR((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pytcookiejar_from_dict�s
$cCs�t|tj�s!td��nt|t�rKt|d|dt�}nXt|tj�r�y|j|�Wq�tk
r�x|D]}|j	|�q�Wq�Xn|S(s�Add cookies to cookiejar and returns a merged CookieJar.

    :param cookiejar: CookieJar object to add the cookies to.
    :param cookies: Dictionary or CookieJar object to be added.
    s!You can only merge into CookieJarRCR�(
RKRRlt
ValueErrorR�R�R^RmtAttributeErrorRN(RCtcookiest
cookie_in_jar((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt
merge_cookies�s

(R,R�tcollectionstcompatRRRRRwtImportErrortdummy_threadingtobjectRR/R;R?R-RFtRuntimeErrorRGRltMutableMappingRHRMRLRR�R�(((sM/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/requests/cookies.pyt<module>s&"
H		�	#	

Zerion Mini Shell 1.0