extract_cookies_to_jar() — requests Function Reference
Architecture documentation for the extract_cookies_to_jar() function in cookies.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 55052edd_2a43_f298_b8d3_9fb1f2641e84["extract_cookies_to_jar()"] 270696ff_2a4f_ef5b_92e8_33a79e68a2d8["cookies.py"] 55052edd_2a43_f298_b8d3_9fb1f2641e84 -->|defined in| 270696ff_2a4f_ef5b_92e8_33a79e68a2d8 7086c4f7_aa89_192d_ccbb_8bfa981ed237["build_response()"] 7086c4f7_aa89_192d_ccbb_8bfa981ed237 -->|calls| 55052edd_2a43_f298_b8d3_9fb1f2641e84 351a1e00_cb4e_af8e_1ed9_e33664efe05e["handle_401()"] 351a1e00_cb4e_af8e_1ed9_e33664efe05e -->|calls| 55052edd_2a43_f298_b8d3_9fb1f2641e84 cbf6862f_d124_817f_3342_f1142c276f25["resolve_redirects()"] cbf6862f_d124_817f_3342_f1142c276f25 -->|calls| 55052edd_2a43_f298_b8d3_9fb1f2641e84 22824d7d_af0c_f593_6513_06ba28a4fc56["send()"] 22824d7d_af0c_f593_6513_06ba28a4fc56 -->|calls| 55052edd_2a43_f298_b8d3_9fb1f2641e84 style 55052edd_2a43_f298_b8d3_9fb1f2641e84 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/requests/cookies.py lines 124–137
def extract_cookies_to_jar(jar, request, response):
"""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
"""
if not (hasattr(response, "_original_response") and response._original_response):
return
# the _original_response field is the wrapped httplib.HTTPResponse object,
req = MockRequest(request)
# pull out the HTTPMessage with the headers and put it in the mock:
res = MockResponse(response._original_response.msg)
jar.extract_cookies(res, req)
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does extract_cookies_to_jar() do?
extract_cookies_to_jar() is a function in the requests codebase, defined in src/requests/cookies.py.
Where is extract_cookies_to_jar() defined?
extract_cookies_to_jar() is defined in src/requests/cookies.py at line 124.
What calls extract_cookies_to_jar()?
extract_cookies_to_jar() is called by 4 function(s): build_response, handle_401, resolve_redirects, send.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free