Skip to content
Myr

Enhance documentation for clarity.

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

authored by Cory Benfield · committed by Cory Benfield · parent f4ec3d2 · Browse files · 1 file+9 added−8 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−8 removed

  • other:+9 added−8 removed

1 file+9 added−8 removed

modified:requests/cookies.py+9 added-8 removed
163 unmodified lines
164 don't specify one, since some clients may expect response.cookies and165 session.cookies to support dict operations.166167 Requests does not use the dict interface internally; it's just for168 compatibility with external client code. All `requests` code should work168 compatibility with external client code. All requests code should work169 out of the box with externally provided instances of ``CookieJar``, e.g.170 ``LWPCookieJar`` and ``FileCookieJar``.171172 Unlike a regular CookieJar, this class is pickleable.
101 unmodified lines
274275 def __getitem__(self, name):276 """Dict-like __getitem__() for compatibility with client code. Throws277 exception if there are more than one cookie with name. In that case,278 use the more explicit get() method instead. Caution: operation is O(n),279 not O(1)."""278 use the more explicit get() method instead.279280 .. warning:: operation is O(n), not O(1)."""281282 return self._find_no_duplicates(name)283284 def __setitem__(self, name, value):285 """Dict-like __setitem__ for compatibility with client code. Throws
34 unmodified lines
320321 raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))322323 def _find_no_duplicates(self, name, domain=None, path=None):323 """__get_item__ and get call _find_no_duplicates -- never used in324 Requests internally. Takes as args name and optional domain and path.325 Returns a cookie.value. Throws KeyError if cookie is not found and326 CookieConflictError if there are multiple cookies that match name and327 optionally domain and path."""324 """Both ``__get_item__`` and ``get`` call this function: it's never325 used elsewhere in Requests. Takes as args name and optional domain and326 path. Returns a cookie.value. Throws KeyError if cookie is not found327 and CookieConflictError if there are multiple cookies that match name328 and optionally domain and path."""329 toReturn = None330 for cookie in iter(self):331 if cookie.name == name:332 if domain is None or cookie.domain == domain:
131 unmodified lines