Skip to content

Commit

Permalink
Merge pull request psf#2536 from smiley/master
Browse files Browse the repository at this point in the history
Document that "PreparedRequest.prepare_cookies" can only be called once
  • Loading branch information
kennethreitz committed Apr 6, 2015
2 parents a57c87a + e3c7b43 commit b0c008c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion requests/models.py
Original file line number Diff line number Diff line change
@@ -501,7 +501,15 @@ def prepare_auth(self, auth, url=''):
self.prepare_content_length(self.body)

def prepare_cookies(self, cookies):
"""Prepares the given HTTP cookie data."""
"""Prepares the given HTTP cookie data.
This function eventually generates a ``Cookie`` header from the
given cookies using cookielib. Due to cookielib's design, the header
will not be regenerated if it already exists, meaning this function
can only be called once for the life of the
:class:`PreparedRequest <PreparedRequest>` object. Any subsequent calls
to ``prepare_cookies`` will have no actual effect, unless the "Cookie"
header is removed beforehand."""

if isinstance(cookies, cookielib.CookieJar):
self._cookies = cookies

0 comments on commit b0c008c

Please sign in to comment.