Copy cookie policy when copying a CookieJar

Without it, the cookie policy would get lost while making a request.
That would be invisible to the user if the default cookie policy wasn't
changed, of course.
This commit is contained in:
Laurent Bachelier
2018-02-14 15:26:13 +01:00
committed by Nate Prewitt
parent d1aeb7ea8c
commit 3ef49272f2
+1
View File
@@ -415,6 +415,7 @@ class RequestsCookieJar(cookielib.CookieJar, collections.MutableMapping):
def copy(self):
"""Return a copy of this RequestsCookieJar."""
new_cj = RequestsCookieJar()
new_cj.set_policy(self._policy)
new_cj.update(self)
return new_cj