Files
witness-fracture/.venv/lib/python3.12/site-packages/requests/__pycache__/cookies.cpython-312.pyc
T

200 lines
25 KiB
Plaintext
Raw Normal View History

2025-06-23 17:55:02 -05:00
Ë
Œ»YhžHãó—dZddlZddlZddlZddlmZddlmZmZm Z m
Z
m Z  ddl Z Gd„d«ZGd„d «Zd
„Zd „Zdd „ZGd
„de«ZGd„de j,e«Zd„Zd„Zd„Zdd„Zd„Zy#e
$rddlZ YŒ[wxYw)z²
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `http.cookiejar.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
éNé)Úto_native_string)ÚMorselÚMutableMappingÚ cookielibÚurlparseÚ
urlunparsecó„—eZdZdZd„Zd„Zd„Zd„Zd„Zd„Z d„Z
dd
„Z d „Z d „Z
d
„Zed„«Zed„«Zed„«Zy )Ú MockRequesta÷Wraps a `requests.Request` to mimic a `urllib2.Request`.
The code in `http.cookiejar.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ó|—||_i|_t|jj«j|_y©N)Ú_rÚ _new_headersrÚurlÚschemeÚtype)ÚselfÚrequests úY/mnt/c/fieldcraft/witness-fracture/.venv/lib/python3.12/site-packages/requests/cookies.pyÚ__init__zMockRequest.__init__#s+€ØˆŒØˆÔܘTŸW™WŸ[™[Ó)×0Ñ0ˆ� ócó—|jSr
)r©rs rÚget_typezMockRequest.get_type(s €Ø�y‰yÐrcóT—t|jj«jSr
)rrrÚnetlocrs rÚget_hostzMockRequest.get_host+s€Ü˜Ÿ™Ÿ ™ Ó$×+Ñ+Ð+rcó"—|j«Sr
©rrs rÚget_origin_req_hostzMockRequest.get_origin_req_host.s€Ø�}‰}‹Ðrcó„—|jjjd«s|jjSt |jjdd¬«}t |jj«}t
|j||j|j|j|jg«S)NÚHostzutf-8)Úencoding) rÚheadersÚgetrrrr rÚpathÚparamsÚqueryÚfragment)rÚhostÚparseds rÚ get_full_urlzMockRequest.get_full_url1s‹€ð�w‰w�‰×"Ñ" 6Ô*Ø—7‘7—;‘;Ð ä §¡§¡°Ñ 7À'ÔJˆÜ˜$Ÿ'™'Ÿ+™+Ó&ˆäà—
‘
ØØ— ‘ Ø—
‘
Ø— ‘ Ø—‘ð

ó 
ð
rcó—y©NT©rs rÚis_unverifiablezMockRequest.is_unverifiableEs€ØrcóR—||jjvxs||jvSr
)rr$r©rÚnames rÚ
has_headerzMockRequest.has_headerHs%€Ø�t—w‘w—‘Ð&ÒC¨$°$×2CÑ2CÐ*CÐCrNcó‚—|jjj||jj||««Sr
)rr$r%r)rr3Údefaults rÚ
get_headerzMockRequest.get_headerKs0€Ø�w‰w�‰×"Ñ" 4¨×):Ñ):×)>Ñ)>¸tÀWÓ)MÓNÐNrcó—td«‚)zMcookiejar 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ÚkeyÚvals rÚ
add_headerzMockRequest.add_headerNs€ä!Ø Kó
ð
rcó"—||j|<yr
©r©rr3Úvalues rÚadd_unredirected_headerz#MockRequest.add_unredirected_headerTs€Ø"'ˆ×ј$Òrcó—|jSr
r>rs rÚget_new_headerszMockRequest.get_new_headersWs€Ø× Ñ Ð rcó"—|j«Sr
)r0rs rÚ unverifiablezMockRequest.unverifiableZs€à×#Ñ#Ó%Ð%rcó"—|j«Sr
)r rs rÚorigin_req_hostzMockRequest.origin_req_host^s€à×'Ñ'Ó)Ð)rcó"—|j«Sr
rrs rr*zMockRequest.hostbs€à�}‰}‹Ðrr
)Ú__name__Ú
__module__Ú __qualname__Ú__doc__rrrr r,r0r4r7r<rArCÚpropertyrErGr*r/rrr r s|„ñ ò1ò
ò,òò
ò(òDóOò
ò (ò!ðñ&óð&ðñ*óð*ðñóñrr có"—eZdZdZd„Zd„Zd„Zy)Ú MockResponsezÅWraps a `httplib.HTTPMessage` to mimic a `urllib.addinfourl`.
...what? Basically, expose the parsed HTTP headers from the server response
the way `http.cookiejar` expects to see them.
có—||_y)z†Make a MockResponse for `cookiejar` to read.
:param headers: a httplib.HTTPMessage or analogous carrying the headers
N©Ú_headers)rr$s rrzMockResponse.__init__ns €ð
 ˆ�
rcó—|jSr
rQrs rÚinfozMockResponse.infous €Ø�}‰}Ðrcó:—|jj|«yr
)rRÚ
getheadersr2s rrVzMockResponse.getheadersxs€Ø �
‰
× Ñ  Õ&rN)rIrJrKrLrrTrVr/rrrOrOgs„ñò  òó'rrOcó®—t|d«r |jsyt|«}t|jj«}|j ||«y)zñExtract the cookies from the response into a CookieJar.
:param jar: http.cookiejar.CookieJar (not necessarily a RequestsCookieJar)
:param request: our own requests.Request object
:param response: urllib3.HTTPResponse object
Ú_original_responseN)ÚhasattrrXr rOÚmsgÚextract_cookies)ÚjarrÚresponseÚreqÚress rÚextract_cookies_to_jarr`|sJ€ô
�HÐ2Ô 3¸×8SÒ8SØä
�gÓ
€Cä
�x×2Ñ2×6Ñ6Ó
7€CØ×ј˜SÕ!rcóx—t|«}|j|«|j«jd«S)zj
Produce an appropriate Cookie header string to be sent with `request`, or None.
:rtype: str
ÚCookie)r Úadd_cookie_headerrCr%)r\rÚrs rÚget_cookie_headerreŒs6€ô �GÓ€AØ×ј!ÔØ × Ñ Ó × "Ñ " 8Ó ,Ð,rcó—g}|D]h}|j|k7rŒ|�||jk7rŒ%|�||jk7rŒ7|j|j|j|jf«Œj|D]\}}}|j |||«Œy)zkUnsets a cookie by name, by default over all domains and paths.
Wraps CookieJar.clear(), is O(n).
N)r3Údomainr&ÚappendÚclear)Ú cookiejarr3rgr&Ú
clearablesÚcookies rÚremove_cookie_by_namerm—sš€ð
€JØòEˆØ �;‰;˜$Ò Ø Ø Ð  &¨F¯M©MÒ"9Ø Ø Ð  ¨¯ © Ò 3Ø Ø×ј6Ÿ=™=¨&¯+©+°v·{±{ÐCÕDðEð)ò,ш��dØ�‰˜  dÕ+ñ,rcó—eZdZdZy)ÚCookieConflictErrorz£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.
N)rIrJrKrLr/rrroroªs„òrroc󼇗eZdZdZdd„Zd„Zd„Zd„Zd„Zd„Z d„Z
d „Z d
„Z d „Z
d „Zdd
„Zˆfd„Zd„Zd„Zd„Zˆfd„Zˆfd„Zdd„Zdd„Zd„Zd„Zd„Zd„ZˆxZS)ÚRequestsCookieJara¶Compatibility class; is a http.cookiejar.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— |j|||«S#t$r|cYSwxYw)zã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.
.. warning:: operation is O(n), not O(1).
)Ú_find_no_duplicatesÚKeyError)rr3r6rgr&s rr%zRequestsCookieJar.getÂs0€ð Ø×+Ñ+¨D°&¸$Ó?Ð ?øÜò ØŠNð ús ‚• #¢#c óÚ—|€.t|||jd«|jd«¬«yt|t«r t |«}n
t ||fi|¤Ž}|j
|«|S)z°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.
Nrgr&)rgr&)rmr%Ú
isinstancerÚmorsel_to_cookieÚ
create_cookieÚ
set_cookie)rr3r@ÚkwargsÚcs rÚsetzRequestsCookieJar.setÎsg€ð ˆ=Ü !Ø�d 6§:¡:¨hÓ#7¸f¿j¹jÈÓ>Põ
ð
ä �eœVÔ $Ü  Ó'‰Aä˜d EÑ4¨VÑ4ˆAØ �‰˜Ô؈rc#óHK—t|«D]}|j–—Œy­w)z”Dict-like iterkeys() that returns an iterator of names of cookies
from the jar.
.. seealso:: itervalues() and iteritems().
N)Úiterr3©rrls rÚiterkeyszRequestsCookieJar.iterkeysás%èø€ô ˜4“jò ˆFØ—+‘+Ó ñ ùó‚ "có4—t|j««S)zƒDict-like keys() that returns a list of names of cookies from the
jar.
.. seealso:: values() and items().
)Úlistr€rs rÚkeyszRequestsCookieJar.keysês€ô �D—M‘M“OÓ$Ð$rc#óHK—t|«D]}|j–—Œy­w)z•Dict-like itervalues() that returns an iterator of values of cookies
from the jar.
.. seealso:: iterkeys() and iteritems().
N)r~r@rs rÚ
itervalueszRequestsCookieJar.itervaluesòs%èø€ô ˜4“jò ˆFØ—,‘,Ó ñ ùr�có4—t|j««S)z„Dict-like values() that returns a list of values of cookies from the
jar.
.. seealso:: keys() and items().
)rƒr†rs rÚvalueszRequestsCookieJar.valuesûs€ô �D—O‘OÓ%Ó&Ð&rc#ó`K—t|«D]}|j|jf–—Œy­w)z•Dict-like iteritems() that returns an iterator of name-value tuples
from the jar.
.. seealso:: iterkeys() and itervalues().
N)r~r3r@rs rÚ iteritemszRequestsCookieJar.iteritemss.èø€ô ˜4“jò ,ˆFØ—+‘+˜vŸ|™|Ð+Ó +ñ ,ùs‚,.có4—t|j««S)zõDict-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Šrs rÚitemszRequestsCookieJar.items s€ô�D—N‘NÓ$Ó%Ð%rcó~—g}t|«D],}|j|vsŒ|j|j«Œ.|S)z2Utility method to list all the domains in the jar.©r~rgrh©rÚdomainsrls rÚ list_domainszRequestsCookieJar.list_domainss=€àˆÜ˜4“jò .ˆFØ�}‰} GÒ+Ø—‘˜vŸ}™}Õ-ð .ðˆrcó~—g}t|«D],}|j|vsŒ|j|j«Œ.|S)z0Utility method to list all the paths in the jar.)r~r&rh)rÚpathsrls rÚ
list_pathszRequestsCookieJar.list_pathss=€àˆÜ˜4“jò *ˆFØ�{‰{ %Ò'Ø— ‘ ˜VŸ[™[Õ)ð *ðˆ rcó–—g}t|«D]9}|j�|j|vry|j|j«Œ;y)zvReturns True if there are multiple domains in the jar.
Returns False otherwise.
:rtype: bool
TFrŽr�s rÚmultiple_domainsz"RequestsCookieJar.multiple_domains%sI€ð ˆÜ˜4“jò *ˆFØ�}‰}Ð(¨V¯]©]¸gÑ-EÙØ �N‰N˜6Ÿ=™=Õ )ð *ðrcó¤—i}t|«D]?}|�|j|k(sŒ|�|j|k(sŒ'|j||j<ŒA|S)z¾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.
:rtype: dict
)r~rgr&r@r3)rrgr&Ú
dictionaryrls rÚget_dictzRequestsCookieJar.get_dict2sV€ðˆ
ܘ4“jò 7ˆFØ� &§-¡-°6Ó"9Ø�  § ¡ ¨tÓ 3à*0¯,©,�
˜6Ÿ;™;Ò'ð  7ð
ÐrcóB•— t‰|�|«S#t$rYywxYwr.)ÚsuperÚ __contains__ro)rr3Ú __class__s €rrœzRequestsCookieJar.__contains__As*ø€ð Ü‘7Ñ'¨Ó-Ð -øÜ"ò Ùð ús ƒ’ �có$—|j|«S)zÿ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.
.. warning:: operation is O(n), not O(1).
)rsr2s rÚ __getitem__zRequestsCookieJar.__getitem__Gs€ð×'Ñ'¨Ó-Ð-rcó(—|j||«y)zÓ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)r|r?s rÚ __setitem__zRequestsCookieJar.__setitem__Ps€ð
�‰��uÕrcó—t||«y)zqDeletes a cookie given a name. Wraps ``http.cookiejar.CookieJar``'s
``remove_cookie_by_name()``.
N)rmr2s rÚ __delitem__zRequestsCookieJar.__delitem__Ws€ô ˜d DÕ)rcó•—t|jd«rW|jjd«r<|jjd«r!|jj dd«|_t ‰|�|g|¢­i|¤ŽS)NÚ
startswithú"z\"Ú)rYr@r¥ÚendswithÚreplacer›ry)rrlÚargsrzr�s €rryzRequestsCookieJar.set_cookie]sgø€ä �F—L‘L ,Ô /Ø— ‘ ×'Ñ'¨Ô,Ø— ‘ ×%Ñ% cÔ*à!Ÿ<™<×/Ñ/°°rÓ:ˆFŒL܉wÑ! &Ð:¨4Ò:°6Ñ:Ð:rcó°•—t|tj«r,|D]&}|jt j|««Œ(yt
‰|�|«y)zAUpdates this jar with cookies from another CookieJar or dict-likeN)rvrÚ CookieJarryÚcopyr›Úupdate)rÚotherrlr�s €rr®zRequestsCookieJar.updatefsEø€ä �eœY×0Ñ0Ô 1Øò
3�Ø—‘¤§ ¡ ¨&Ó 1Õ2ñ
3ô
‰G‰N˜5Õ !rcóÌ—t|«D]C}|j|k(sŒ|�|j|k(sŒ%|�|j|k(sŒ7|jcSt d|›d|›d|›�«‚)aÔRequests uses this method internally to get cookie values.
If there are conflicting cookies, _find arbitrarily chooses one.
See _find_no_duplicates if you want an exception thrown if there are
conflicting cookies.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie
:return: cookie.value
úname=ú , domain=ú, path=)r~r3rgr&r@rt)rr3rgr&rls rÚ_findzRequestsCookieJar._findnsm€ô˜4“jò ,ˆFØ�{‰{˜dÓ"Ø�> V§]¡]°fÓ%<Ø�| v§{¡{°dÓ':Ø%Ÿ|™|Ò+ð  ,ô ˜˜t˜h i°¨z¸ÀÀÐIÓJÐJrcóö—d}t|«D]R}|j|k(sŒ|�|j|k(sŒ%|�|j|k(sŒ7|�t d|›�«‚|j
}ŒT|r|St
d|›d|›d|›�«‚)aùBoth ``__get_item__`` and ``get`` call this function: it's never
used elsewhere in Requests.
:param name: a string containing name of cookie
:param domain: (optional) string containing domain of cookie
:param path: (optional) string containing path of cookie