Skip to content
Myr

Add a public method to get the cookie policy

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Laurent Bachelier · committed by Nate Prewitt · parent ace0c20 · Browse files · 2 files+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+6 added−2 removed

  • tests:+1 added−1 removed
  • other:+5 added−1 removed

2 files+6 added−2 removed

modified:requests/cookies.py+5 added-1 removed
413 unmodified lines
414415 def copy(self):416 """Return a copy of this RequestsCookieJar."""417 new_cj = RequestsCookieJar()418 new_cj.set_policy(self._policy)418 new_cj.set_policy(self.get_policy())419 new_cj.update(self)420 return new_cj421422 def get_policy(self):423 """Return the CookiePolicy instance used."""424 return self._policy425426427def _copy_cookie_jar(jar):428 if jar is None:429 return None430
117 unmodified lines
modified:tests/test_requests.py+1 added-1 removed
1175 unmodified lines
1176 pass11771178 jar = requests.cookies.RequestsCookieJar()1179 jar.set_policy(MyCookiePolicy())1180 assert isinstance(jar.copy()._policy, MyCookiePolicy)1180 assert isinstance(jar.copy().get_policy(), MyCookiePolicy)11811182 def test_time_elapsed_blank(self, httpbin):1183 r = requests.get(httpbin('get'))1184 td = r.elapsed
1291 unmodified lines