Skip to content
Myr

#2532: Documented strange behaviour in "PreparedRequest.prepare_cookies", caused by cookielib. Also documented a workaround if absolutely necessary.

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

authored by Smiley Barry · committed by Smiley Barry · parent 956ec83 · Browse files · 1 file+9 added−1 removed
This commit

State

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

Diff stats

1 file+9 added−1 removed

  • other:+9 added−1 removed

1 file+9 added−1 removed

modified:requests/models.py+9 added-1 removed
499 unmodified lines
500 # Recompute Content-Length501 self.prepare_content_length(self.body)502503 def prepare_cookies(self, cookies):504 """Prepares the given HTTP cookie data."""504 """Prepares the given HTTP cookie data.505506 This function eventually generates a ``Cookie`` header from the507 given cookies using cookielib. Due to cookielib's design, the header508 will not be regenerated if it already exists, meaning this function509 can only be called once for the life of the510 :class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls511 to ``prepare_cookies`` will have no actual effect, unless the "Cookie"512 header is removed beforehand."""513514 if isinstance(cookies, cookielib.CookieJar):515 self._cookies = cookies516 else:517 self._cookies = cookiejar_from_dict(cookies)
337 unmodified lines