Clear some cookies. Invoking this method without arguments will clear all cookies. If given a single argument, only cookies belonging to that domain will be removed. If given two arguments, cookies belonging to the specified path within that domain are removed. If
(self, domain=None, path=None, name=None)
| 1691 | self._cookies_lock.release() |
| 1692 | |
| 1693 | def clear(self, domain=None, path=None, name=None): |
| 1694 | """Clear some cookies. |
| 1695 | |
| 1696 | Invoking this method without arguments will clear all cookies. If |
| 1697 | given a single argument, only cookies belonging to that domain will be |
| 1698 | removed. If given two arguments, cookies belonging to the specified |
| 1699 | path within that domain are removed. If given three arguments, then |
| 1700 | the cookie with the specified name, path and domain is removed. |
| 1701 | |
| 1702 | Raises KeyError if no matching cookie exists. |
| 1703 | |
| 1704 | """ |
| 1705 | if name is not None: |
| 1706 | if (domain is None) or (path is None): |
| 1707 | raise ValueError( |
| 1708 | "domain and path must be given to remove a cookie by name") |
| 1709 | del self._cookies[domain][path][name] |
| 1710 | elif path is not None: |
| 1711 | if domain is None: |
| 1712 | raise ValueError( |
| 1713 | "domain must be given to remove cookies by path") |
| 1714 | del self._cookies[domain][path] |
| 1715 | elif domain is not None: |
| 1716 | del self._cookies[domain] |
| 1717 | else: |
| 1718 | self._cookies = {} |
| 1719 | |
| 1720 | def clear_session_cookies(self): |
| 1721 | """Discard all session cookies. |
no outgoing calls