Skip to content

Commit

Permalink
More explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
twm committed Apr 30, 2024
1 parent 9e07ffb commit 1d6fb74
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/treq/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ def request(
if not isinstance(cookies, CookieJar):
cookies = _scoped_cookiejar_from_dict(parsed_url, cookies)

jar: CookieJar = merge_cookies(self._cookiejar, cookies)
wrapped_agent: IAgent = CookieAgent(self._agent, jar)
merge_cookies(self._cookiejar, cookies)
wrapped_agent: IAgent = CookieAgent(self._agent, self._cookiejar)

if allow_redirects:
if browser_like_redirects:
Expand Down Expand Up @@ -312,7 +312,7 @@ def gotResult(result):
if not unbuffered:
d.addCallback(_BufferedResponse)

return d.addCallback(_Response, jar)
return d.addCallback(_Response, self._cookiejar)

def _request_headers(
self, headers: Optional[_HeadersType], stacklevel: int
Expand Down
4 changes: 4 additions & 0 deletions src/treq/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ def cookies(self) -> CookieJar:
"""
Get a copy of this response's cookies.
"""
# NB: This actually returns a RequestsCookieJar, but we type it as a
# regular CookieJar because we want to ditch requests as a dependency.
# Full deprecation deprecation will require a subclass or wrapper that
# warns about the RequestCookieJar extensions.
jar: CookieJar = cookiejar_from_dict({})

for cookie in self._cookiejar:
Expand Down

0 comments on commit 1d6fb74

Please sign in to comment.