2biH S r SSKrSSKrSSKrSSKJr SSKJrJrJ r J r Jr SSKr " S S5 r " S S 5 rS rS rSS jr " S S\5 r " S S\ R, \5 rS rS rS rSS jrS rg! \ a SSKr N^f = f)z requests.cookies ~~~~~~~~~~~~~~~~ Compatibility code to be able to use `cookielib.CookieJar` with requests. requests.utils imports from here, so be careful with imports. N )to_native_string)MorselMutableMapping cookieliburlparse urlunparsec \ rS rSrSrS rS rS rS rS r S r S rSS jrS r S rS r\S 5 r\S 5 r\S 5 rSrg )MockRequest a 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. c z Xl 0 U l [ U R R 5 R U l g N)_r_new_headersr urlschemetype)selfrequests ڎ/builddir/build/BUILDROOT/alt-python313-pip-23.3.1-3.el8.x86_64/opt/alt/python313/lib/python3.13/site-packages/pip/_vendor/requests/cookies.py__init__MockRequest.__init__# s) TWW[[)00 c U R $ r )r r s r get_typeMockRequest.get_type( s yyr c T [ U R R 5 R $ r )r r r netlocr s r get_hostMockRequest.get_host+ s $+++r c " U R 5 $ r r r s r get_origin_req_hostMockRequest.get_origin_req_host. s }}r c U R R R S5 ( d U R R $ [ U R R S SS9n[ U R R 5 n[ UR UUR UR UR UR /5 $ )NHostzutf-8)encoding)r headersgetr r r r r pathparamsqueryfragment)r hostparseds r get_full_urlMockRequest.get_full_url1 s ww""6**77;; 7'J$''++& r c gNT r s r is_unverifiableMockRequest.is_unverifiableE s r c \ XR R ; =( d XR ; $ r )r r) r r names r has_headerMockRequest.has_headerH s! ww&C$2C2C*CCr Nc ~ U R R R XR R X5 5 $ r )r r) r* r )r r: defaults r get_headerMockRequest.get_headerK s, ww""4):):)>)>t)MNNr c [ S5 e)zMcookielib has no legitimate use for this method; add it back if you find one.z=Cookie headers should be added with add_unredirected_header())NotImplementedError)r keyvals r add_headerMockRequest.add_headerN s !K r c X R U' g r r r r: values r add_unredirected_header#MockRequest.add_unredirected_headerT s "'$r c U R $ r rH r s r get_new_headersMockRequest.get_new_headersW s r c " U R 5 $ r )r6 r s r unverifiableMockRequest.unverifiableZ s ##%%r c " U R 5 $ r )r$ r s r origin_req_hostMockRequest.origin_req_host^ s ''))r c " U R 5 $ r r# r s r r/ MockRequest.hostb s }}r )r r r r )__name__ __module____qualname____firstlineno____doc__r r r r$ r1 r6 r; r? rE rK rN propertyrQ rT r/ __static_attributes__r5 r r r r s| 1 , (DO (! & & * * r r c * \ rS rSrSrS rS rS rSrg)MockResponseg zWraps 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. c Xl g)zvMake a MockResponse for `cookielib` to read. :param headers: a httplib.HTTPMessage or analogous carrying the headers N_headers)r r) s r r MockResponse.__init__n s r c U R $ r rc r s r infoMockResponse.infou s }}r c : U R R U5 g r )rd getheadersr9 s r rj MockResponse.getheadersx s &r rc N) rX rY rZ r[ r\ r rg rj r^ r5 r r r` r` g s 'r r` c [ US5 ( a UR ( d g[ U5 n[ UR R 5 nU R XC5 g)zExtract 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 _original_responseN)hasattrrm r r` msgextract_cookies)jarr responsereqress r extract_cookies_to_jarru | sK H2338S8S g C x2266 7C!r c x [ U5 nU R U5 UR 5 R S5 $ )z^ Produce an appropriate Cookie header string to be sent with `request`, or None. :rtype: str Cookie)r add_cookie_headerrN r* )rq r rs r get_cookie_headerrz s6 GA!""8,,r c . / nU Ho nUR U:w a M Ub X%R :w a M) Ub X5R :w a M= UR UR UR UR 45 Mq U H u p#nU R X#U5 M g)zcUnsets a cookie by name, by default over all domains and paths. Wraps CookieJar.clear(), is O(n). N)r: domainr+ appendclear) cookiejarr: r| r+ clearablescookies r remove_cookie_by_namer s J;;$&MM"9 36==&++v{{CD )dd+ )r c \ rS rSrSrSrg)CookieConflictError zThere 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. r5 N)rX rY rZ r[ r\ r^ r5 r r r r s r r c ^ \ rS rSrSrSS jrS rS rS rS r S r S rS rS r S rS rSS jrU 4S jrS rS rS rU 4S jrU 4S jrSS jrSS jrS rS rS rS rSrU =r$ )RequestsCookieJar a 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. Requests does not use the dict interface internally; it's just for compatibility with external client code. All requests code should work out of the box with externally provided instances of ``CookieJar``, e.g. ``LWPCookieJar`` and ``FileCookieJar``. Unlike a regular CookieJar, this class is pickleable. .. warning:: dictionary operations that are normally O(1) may be O(n). c L U R XU5 $ ! [ a Us $ f = f)zDict-like get() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. .. warning:: operation is O(n), not O(1). )_find_no_duplicatesKeyError)r r: r> r| r+ s r r* RequestsCookieJar.get s. ++D$?? N s ##c Uc* [ XUR S5 UR S5 S9 g[ U[ 5 ( a [ U5 nO[ X40 UD6nU R U5 U$ )zDict-like set() that also supports optional domain and path args in order to resolve naming collisions from using one cookie jar over multiple domains. Nr| r+ )r| r+ )r r* isinstancer morsel_to_cookie create_cookie set_cookie)r r: rJ kwargscs r setRequestsCookieJar.set sf =!6::h#7fjj>P eV$$ 'Ad4V4Ar c # L # [ U 5 H nUR v M g7f)z|Dict-like iterkeys() that returns an iterator of names of cookies from the jar. .. seealso:: itervalues() and iteritems(). N)iterr: r r s r iterkeysRequestsCookieJar.iterkeys s 4jF++ ! "$c 4 [ U R 5 5 $ )zkDict-like keys() that returns a list of names of cookies from the jar. .. seealso:: values() and items(). )listr r s r keysRequestsCookieJar.keys s DMMO$$r c # L # [ U 5 H nUR v M g7f)z}Dict-like itervalues() that returns an iterator of values of cookies from the jar. .. seealso:: iterkeys() and iteritems(). N)r rJ r s r itervaluesRequestsCookieJar.itervalues s 4jF,, !r c 4 [ U R 5 5 $ )zlDict-like values() that returns a list of values of cookies from the jar. .. seealso:: keys() and items(). )r r r s r valuesRequestsCookieJar.values s DOO%&&r c # d # [ U 5 H nUR UR 4v M g7f)z}Dict-like iteritems() that returns an iterator of name-value tuples from the jar. .. seealso:: iterkeys() and itervalues(). N)r r: rJ r s r iteritemsRequestsCookieJar.iteritems s( 4jF++v||++ !s .0c 4 [ U R 5 5 $ )zDict-like items() that returns a list of name-value tuples from the jar. Allows client-code to call ``dict(RequestsCookieJar)`` and get a vanilla python dict of key value pairs. .. seealso:: keys() and values(). )r r r s r itemsRequestsCookieJar.items s DNN$%%r c / n[ U 5 H0 nUR U; d M UR UR 5 M2 U$ )z2Utility method to list all the domains in the jar.r r| r} r domainsr s r list_domainsRequestsCookieJar.list_domains s8 4jF}}G+v}}- ! r c / n[ U 5 H0 nUR U; d M UR UR 5 M2 U$ )z0Utility method to list all the paths in the jar.)r r+ r} )r pathsr s r list_pathsRequestsCookieJar.list_paths s8 4jF{{%'V[[) ! r c / n[ U 5 H= nUR b UR U; a gUR UR 5 M? g)z^Returns True if there are multiple domains in the jar. Returns False otherwise. :rtype: bool TFr r s r multiple_domains"RequestsCookieJar.multiple_domains% sD 4jF}}(V]]g-ENN6==) ! r c 0 n[ U 5 HE nUb UR U:X d M Ub UR U:X d M- UR X4R ' MG U$ )zTakes 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. :rtype: dict )r r| r+ rJ r: )r r| r+ dictionaryr s r get_dictRequestsCookieJar.get_dict2 sO 4jF&--6"9t 3*0,, ;;' ! r c D > [ TU ] U5 $ ! [ a gf = fr4 )super__contains__r )r r: __class__s r r RequestsCookieJar.__contains__A s* 7'--" s c $ U R U5 $ )zDict-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. .. warning:: operation is O(n), not O(1). )r r9 s r __getitem__RequestsCookieJar.__getitem__G s ''--r c &