Discard all expired cookies. You probably don't need to call this method: expired cookies are never sent back to the server (provided you're using DefaultCookiePolicy), this method is called by CookieJar itself every so often, and the .save() method won't save expire
(self)
| 1733 | self._cookies_lock.release() |
| 1734 | |
| 1735 | def clear_expired_cookies(self): |
| 1736 | """Discard all expired cookies. |
| 1737 | |
| 1738 | You probably don't need to call this method: expired cookies are never |
| 1739 | sent back to the server (provided you're using DefaultCookiePolicy), |
| 1740 | this method is called by CookieJar itself every so often, and the |
| 1741 | .save() method won't save expired cookies anyway (unless you ask |
| 1742 | otherwise by passing a true ignore_expires argument). |
| 1743 | |
| 1744 | """ |
| 1745 | self._cookies_lock.acquire() |
| 1746 | try: |
| 1747 | now = time.time() |
| 1748 | for cookie in self: |
| 1749 | if cookie.is_expired(now): |
| 1750 | self.clear(cookie.domain, cookie.path, cookie.name) |
| 1751 | finally: |
| 1752 | self._cookies_lock.release() |
| 1753 | |
| 1754 | def __iter__(self): |
| 1755 | return deepvalues(self._cookies) |
no test coverage detected