Skip to content
Myr

Merge pull request #2536 from smiley/master

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

Document that "PreparedRequest.prepare_cookies" can only be called once

authored by Kenneth Reitz · committed by Kenneth Reitz · parents a57c87a, e3c7b43 · 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