Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit fcbe630

Browse files
committed
Add code comment about discarding expired IAMSession cookies
1 parent fdb08de commit fcbe630

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/cloudant/_common_util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,14 @@ def request(self, method, url, **kwargs): # pylint: disable=W0221
421421
Overrides ``requests.Session.request`` to renew the IAM cookie
422422
and then retry the original request (if required).
423423
"""
424+
# The CookieJar API prevents callers from getting an individual Cookie
425+
# object by name.
426+
# We are forced to use the only exposed method of discarding expired
427+
# cookies from the CookieJar. Internally this involves iterating over
428+
# the entire CookieJar and calling `.is_expired()` on each Cookie
429+
# object.
424430
self.cookies.clear_expired_cookies()
431+
425432
if self._auto_renew and 'IAMSession' not in self.cookies.keys():
426433
self.login()
427434

0 commit comments

Comments
 (0)